update at 2021-02-20 10:40:35 by ehlxr

This commit is contained in:
ehlxr 2021-02-20 10:40:35 +08:00
parent 268072ad2a
commit d32a075c5a
3 changed files with 26 additions and 9 deletions

Binary file not shown.

View File

@ -24,42 +24,44 @@
package io.github.ehlxr;
import com.google.common.collect.Maps;
/**
* Created by ehlxr on 2016/12/23.
*/
public class dfd {
public static void main(String[] args) {
// var map = Maps.newHashMap();
// map.put("d",1);
// System.out.println(map);
var map = Maps.newHashMap();
map.put("d", 1);
System.out.println(map);
}
public void printCircle(int[][] matrix, int startX, int startY, int endX, int endY) {
// only one column left
if (startY == endY) {
for (int i = startX; i <= endX; i++ ) {
for (int i = startX; i <= endX; i++) {
System.out.println(matrix[i][endY]);
}
return;
}
// only one row left
if (startX == endX) {
for (int i = startY; i <= endY; i++ ) {
for (int i = startY; i <= endY; i++) {
System.out.println(matrix[startX][i]);
}
return;
}
for (int i = startY; i < endY; i++ ) {
for (int i = startY; i < endY; i++) {
System.out.println(matrix[startX][i]);
}
for (int i = startX; i < endX; i++ ) {
for (int i = startX; i < endX; i++) {
System.out.println(matrix[i][endY]);
}
for (int i = endY; i > startY; i-- ) {
for (int i = endY; i > startY; i--) {
System.out.println(matrix[endX][i]);
}
for (int i = endX; i > startX; i-- ) {
for (int i = endX; i > startX; i--) {
System.out.println(matrix[i][startY]);
}

View File

@ -24,6 +24,8 @@
package io.github.ehlxr.test;
import java.util.LinkedHashMap;
/**
* Created by ehlxr on 2016/12/15.
*/
@ -39,5 +41,18 @@ public class Test {
System.out.println(s0 == s1);
System.out.println(s0 == s1.intern());
System.out.println(s0 == s2);
// LinkedHashMap
System.out.println("*****LinkedHashMap*****");
LinkedHashMap<Object, Object> map = new LinkedHashMap<>();
map.put("a", "111");
map.put("b", "222");
map.put("c", "333");
map.put("d", "444");
map.put("a", "555");
System.out.println(map);
}
}