Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/367.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何对树映射的键集()进行排序<;字符串,布尔值>;用包含数字的键?_Java_Sorting_Treemap_Keyset - Fatal编程技术网

Java 如何对树映射的键集()进行排序<;字符串,布尔值>;用包含数字的键?

Java 如何对树映射的键集()进行排序<;字符串,布尔值>;用包含数字的键?,java,sorting,treemap,keyset,Java,Sorting,Treemap,Keyset,我将简要描述我做了什么,然后说明我得到的结果与我期望的结果有什么不同 提前感谢您的建议 Java代码是在Java在线编译器中创建的,在任何情况下都是可执行的,没有错误消息 简要说明: 我想为方阵的行索引和列索引之间的每个可能组合指定一个布尔值。只有主对角线被排除在外。为此,我使用了一个TreeMap 我通过在for循环中链接{row index+“-”+column index}来形成TreeMap的键。开始时,所有键的值都被赋值{false} 在第二个循环中,所选索引basicL与其他索引(

我将简要描述我做了什么,然后说明我得到的结果与我期望的结果有什么不同

提前感谢您的建议

Java代码是在Java在线编译器中创建的,在任何情况下都是可执行的,没有错误消息

简要说明: 我想为方阵的行索引和列索引之间的每个可能组合指定一个布尔值。
只有主对角线被排除在外。为此,我使用了一个
TreeMap

我通过在for循环中链接{row index+“-”+column index}来形成
TreeMap的键。
开始时,所有键的值都被赋值{false}

在第二个循环中,所选索引
basicL
与其他索引(=键)的每个可能组合都将与布尔值true(同样没有主对角线的值)链接。因此,
TreeMap.keySet()
将按排序顺序(按键排序)打印。例如
basicL=4

矩阵图解(布尔真=绿色,布尔假=白色,排除=灰色):

Java代码:
import java.util.TreeMap;
公共班机{
静态树映射booleanMap=新树映射();
公共静态void main(字符串[]args){
//无对角轴对称矩阵的所有值
int max=16;
int-basicL=4;

for(int i=1;i树映射中的默认字符串是sort By。您需要一个in
TreeMap
来进行数字排序

TreeMap booleanMap=新的TreeMap((s1,s2)->{
字符串[]arr1=s1.split(“”);
字符串[]arr2=s2.split(“”);
int i1=整数.valueOf(arr1[0]);
int j1=整数.valueOf(arr1[1]);
int i2=整数.valueOf(arr2[0]);
int j2=整数.valueOf(arr2[1]);
如果(i1!=i2){
返回整数。比较(i1,i2);
}
返回整数。比较(j1,j2);
});

默认情况下,树映射中的字符串是sort By。您需要在
树映射中使用一个字符串来进行数字排序

TreeMap booleanMap=新的TreeMap((s1,s2)->{
字符串[]arr1=s1.split(“”);
字符串[]arr2=s2.split(“”);
int i1=整数.valueOf(arr1[0]);
int j1=整数.valueOf(arr1[1]);
int i2=整数.valueOf(arr2[0]);
int j2=整数.valueOf(arr2[1]);
如果(i1!=i2){
返回整数。比较(i1,i2);
}
返回整数。比较(j1,j2);
});

索引是按字典顺序排序的,而不是根据数字的值。解决方法是预先设置零(
1-12
->
001-012
)。另一种方法是将自定义比较器传递给树映射的构造函数,如@samabcde的答案所示

我建议您为矩阵中的位置创建一个自定义类。您可以实现
compareTo
,它让
TreeMap
为您自动处理排序。此外,您还可以显著简化第二个循环并删除布尔值的装箱

TreeMap<Position, Boolean> booleanMap = new TreeMap<>();

int max = 16;
int basicL = 4;

for (int i = 1; i <= max; i++) {
    for (int j = 1; j <= max; j++) {
        if (j != i) {
            booleanMap.put(new Position(i, j), Boolean.FALSE);
        }
    }
}
TreeMap booleanMap=newtreemap();
int max=16;
int-basicL=4;

对于(int i=1;i索引是按字典顺序排序的,而不是根据数字的值。解决方法是预先加上零(
1-12
->
001-012
)。另一种方法是将自定义比较器传递给TreeMap的构造函数,如@samabcde的回答所示

我建议您为矩阵中的位置创建一个自定义类。您可以实现
compareTo
,它让
TreeMap
为您自动处理排序。此外,您还可以显著简化第二个循环并删除布尔值的装箱

TreeMap<Position, Boolean> booleanMap = new TreeMap<>();

int max = 16;
int basicL = 4;

for (int i = 1; i <= max; i++) {
    for (int j = 1; j <= max; j++) {
        if (j != i) {
            booleanMap.put(new Position(i, j), Boolean.FALSE);
        }
    }
}
TreeMap booleanMap=newtreemap();
int max=16;
int-basicL=4;
谢谢你的帮助

我现在尝试了以下方法:

  • @clstrfsck(String.format())
  • @samabcde(自定义比较器)
  • @matt(创建自定义类)
  • 解决方案方法1和3我能够成功地使用并生成所需的输出。
    方法2我还不太了解,因为我仍然缺乏lamda表达式的背景知识,但也许我会把它做好

    使用String.format 我还使用了迭代器和子字符串来生成键值对并将其格式化

    import java.util.TreeMap;
    import java.util.*;
    
    public class Main {
    
      static TreeMap<String, Boolean> booleanMap = new TreeMap<>();
      
      static String subKey;
      static String subKey2;
      static Integer subKey3;
      static Integer subKey4;
      static String formattedKey;
    
      public static void main(String[] args) {
    
        //all values of symmetric matrix without diagonal axis
    
        int max = 16;
        int basicL = 4;
    
        for (int i = 1; i <= max; i++) {
    
          for (int j = 1; j <= max; j++) {
    
            if (j != i) {
              booleanMap.put(String.format("%03d-%03d", i, j), Boolean.FALSE);
            }
          }
        }
    
        for (int i = 1; i <= max; i++) {
    
          if (i != basicL) {
    
            for (int j = 1; j <= max; j++) {
    
              if (j == basicL) {
    
                booleanMap.replace(String.format("%03d-%03d", i, j), Boolean.TRUE);
              }
            }
          }
    
          if (i == basicL) {
    
            for (int j = 1; j <= max; j++) {
    
              if (j != i) {
    
                booleanMap.replace(String.format("%03d-%03d", i, j), Boolean.TRUE);
    
              }
            }
          }
        }
        
         Iterator<Map.Entry<String, Boolean>> itr = booleanMap.entrySet().iterator();
         
         System.out.println("------KEY-VALUE PAIRS------");
             
            while(itr.hasNext())
            {
                 Map.Entry<String, Boolean> entry = itr.next();
                 
                 subKey = entry.getKey().substring(0, 3);
                 subKey2 = entry.getKey().substring(4, 7);
                 subKey3 = Integer.parseInt(subKey);
                 subKey4 = Integer.parseInt(subKey2);
                 
                 formattedKey = subKey3 +"-"+ subKey4;
                 
                 System.out.println("Key:" + formattedKey + " ,Value:" + entry.getValue());                     
                
            }
      }
    }
    
    创建自定义类(我的最佳工作解决方案) 谢谢你的帮助

    我现在尝试了以下方法:

  • @clstrfsck(String.format())
  • @samabcde(自定义比较器)
  • @matt(创建自定义类)
  • 解决方案方法1和3我能够成功地使用并生成所需的输出。
    方法2我还不太了解,因为我仍然缺乏lamda表达式的背景知识,但也许我会把它做好

    使用String.format 我还使用了迭代器和子字符串来生成键值对并将其格式化

    import java.util.TreeMap;
    import java.util.*;
    
    public class Main {
    
      static TreeMap<String, Boolean> booleanMap = new TreeMap<>();
      
      static String subKey;
      static String subKey2;
      static Integer subKey3;
      static Integer subKey4;
      static String formattedKey;
    
      public static void main(String[] args) {
    
        //all values of symmetric matrix without diagonal axis
    
        int max = 16;
        int basicL = 4;
    
        for (int i = 1; i <= max; i++) {
    
          for (int j = 1; j <= max; j++) {
    
            if (j != i) {
              booleanMap.put(String.format("%03d-%03d", i, j), Boolean.FALSE);
            }
          }
        }
    
        for (int i = 1; i <= max; i++) {
    
          if (i != basicL) {
    
            for (int j = 1; j <= max; j++) {
    
              if (j == basicL) {
    
                booleanMap.replace(String.format("%03d-%03d", i, j), Boolean.TRUE);
              }
            }
          }
    
          if (i == basicL) {
    
            for (int j = 1; j <= max; j++) {
    
              if (j != i) {
    
                booleanMap.replace(String.format("%03d-%03d", i, j), Boolean.TRUE);
    
              }
            }
          }
        }
        
         Iterator<Map.Entry<String, Boolean>> itr = booleanMap.entrySet().iterator();
         
         System.out.println("------KEY-VALUE PAIRS------");
             
            while(itr.hasNext())
            {
                 Map.Entry<String, Boolean> entry = itr.next();
                 
                 subKey = entry.getKey().substring(0, 3);
                 subKey2 = entry.getKey().substring(4, 7);
                 subKey3 = Integer.parseInt(subKey);
                 subKey4 = Integer.parseInt(subKey2);
                 
                 formattedKey = subKey3 +"-"+ subKey4;
                 
                 System.out.println("Key:" + formattedKey + " ,Value:" + entry.getValue());                     
                
            }
      }
    }
    
    创建自定义类(我的最佳工作解决方案)
    您的结果是否包含正确的键值,并且您的问题只是排序错误?可能使用
    String.format(“%03d-%03d”,i,j)
    作为键?这是否回答了您的问题?这很可能是一个排序问题,其中键不会被解释为数字,而是字符串。@厄立特里亚人:是的,它会将值映射到正确的键以及TreeMap.size()等于没有主对角线的16×16矩阵。唯一的问题是,在生成的输出中,它将例如4-10放在4-5之前。我假设树映射在字符串的每个字符之后按升序排序,因此10总是放在带有{2…9}的单个数字之前因为1较小。您的结果是否包含正确的键值,并且您的问题只是排序错误?可能使用
    String.format(“%03d-%03d”,i,j)
    作为键?这是否回答了您的问题?这很可能是一个排序问题,其中键没有得到解释
    static class Position implements Comparable<Position> {
    
        private final int x;
        private final int y;
    
        public Position(final int x, final int y) {
            this.x = x;
            this.y = y;
        }
    
        public int getX() {
            return x;
        }
    
        public int getY() {
            return y;
        }
    
        @Override
        public int compareTo(final Position o) {
            final int res = Integer.compare(getX(), o.getX());
            return (res != 0) ? res : Integer.compare(getY(), o.getY());
        }
    
        @Override
        public String toString() {
            return x + "-" + y;
        }
    }
    
    import java.util.TreeMap;
    import java.util.*;
    
    public class Main {
    
      static TreeMap<String, Boolean> booleanMap = new TreeMap<>();
      
      static String subKey;
      static String subKey2;
      static Integer subKey3;
      static Integer subKey4;
      static String formattedKey;
    
      public static void main(String[] args) {
    
        //all values of symmetric matrix without diagonal axis
    
        int max = 16;
        int basicL = 4;
    
        for (int i = 1; i <= max; i++) {
    
          for (int j = 1; j <= max; j++) {
    
            if (j != i) {
              booleanMap.put(String.format("%03d-%03d", i, j), Boolean.FALSE);
            }
          }
        }
    
        for (int i = 1; i <= max; i++) {
    
          if (i != basicL) {
    
            for (int j = 1; j <= max; j++) {
    
              if (j == basicL) {
    
                booleanMap.replace(String.format("%03d-%03d", i, j), Boolean.TRUE);
              }
            }
          }
    
          if (i == basicL) {
    
            for (int j = 1; j <= max; j++) {
    
              if (j != i) {
    
                booleanMap.replace(String.format("%03d-%03d", i, j), Boolean.TRUE);
    
              }
            }
          }
        }
        
         Iterator<Map.Entry<String, Boolean>> itr = booleanMap.entrySet().iterator();
         
         System.out.println("------KEY-VALUE PAIRS------");
             
            while(itr.hasNext())
            {
                 Map.Entry<String, Boolean> entry = itr.next();
                 
                 subKey = entry.getKey().substring(0, 3);
                 subKey2 = entry.getKey().substring(4, 7);
                 subKey3 = Integer.parseInt(subKey);
                 subKey4 = Integer.parseInt(subKey2);
                 
                 formattedKey = subKey3 +"-"+ subKey4;
                 
                 System.out.println("Key:" + formattedKey + " ,Value:" + entry.getValue());                     
                
            }
      }
    }
    
    ------KEY-VALUE PAIRS------
    
    Key:1-2 ,Value:false
    Key:1-3 ,Value:false
    Key:1-4 ,Value:true
    Key:1-5 ,Value:false
    Key:1-6 ,Value:false
    Key:1-7 ,Value:false
    Key:1-8 ,Value:false
    Key:1-9 ,Value:false
    Key:1-10 ,Value:false
    Key:1-11 ,Value:false
    Key:1-12 ,Value:false
    Key:1-13 ,Value:false
    Key:1-14 ,Value:false
    Key:1-15 ,Value:false
    Key:1-16 ,Value:false
    Key:2-1 ,Value:false
    Key:2-3 ,Value:false
    Key:2-4 ,Value:true
    Key:2-5 ,Value:false
    Key:2-6 ,Value:false
    Key:2-7 ,Value:false
    Key:2-8 ,Value:false
    Key:2-9 ,Value:false
    Key:2-10 ,Value:false
    Key:2-11 ,Value:false
    Key:2-12 ,Value:false
    Key:2-13 ,Value:false
    Key:2-14 ,Value:false
    Key:2-15 ,Value:false
    Key:2-16 ,Value:false
    Key:3-1 ,Value:false
    Key:3-2 ,Value:false
    Key:3-4 ,Value:true
    Key:3-5 ,Value:false
    Key:3-6 ,Value:false
    Key:3-7 ,Value:false
    Key:3-8 ,Value:false
    Key:3-9 ,Value:false
    Key:3-10 ,Value:false
    Key:3-11 ,Value:false
    Key:3-12 ,Value:false
    Key:3-13 ,Value:false
    Key:3-14 ,Value:false
    Key:3-15 ,Value:false
    Key:3-16 ,Value:false
    Key:4-1 ,Value:true
    Key:4-2 ,Value:true
    Key:4-3 ,Value:true
    Key:4-5 ,Value:true
    Key:4-6 ,Value:true
    Key:4-7 ,Value:true
    Key:4-8 ,Value:true
    Key:4-9 ,Value:true
    Key:4-10 ,Value:true
    Key:4-11 ,Value:true
    Key:4-12 ,Value:true
    Key:4-13 ,Value:true
    Key:4-14 ,Value:true
    Key:4-15 ,Value:true
    Key:4-16 ,Value:true
    Key:5-1 ,Value:false
    Key:5-2 ,Value:false
    Key:5-3 ,Value:false
    Key:5-4 ,Value:true
    Key:5-6 ,Value:false
    Key:5-7 ,Value:false
    Key:5-8 ,Value:false
    Key:5-9 ,Value:false
    Key:5-10 ,Value:false
    Key:5-11 ,Value:false
    Key:5-12 ,Value:false
    Key:5-13 ,Value:false
    Key:5-14 ,Value:false
    Key:5-15 ,Value:false
    Key:5-16 ,Value:false
    Key:6-1 ,Value:false
    Key:6-2 ,Value:false
    Key:6-3 ,Value:false
    Key:6-4 ,Value:true
    Key:6-5 ,Value:false
    Key:6-7 ,Value:false
    Key:6-8 ,Value:false
    Key:6-9 ,Value:false
    Key:6-10 ,Value:false
    Key:6-11 ,Value:false
    Key:6-12 ,Value:false
    Key:6-13 ,Value:false
    Key:6-14 ,Value:false
    Key:6-15 ,Value:false
    Key:6-16 ,Value:false
    Key:7-1 ,Value:false
    Key:7-2 ,Value:false
    Key:7-3 ,Value:false
    Key:7-4 ,Value:true
    Key:7-5 ,Value:false
    Key:7-6 ,Value:false
    Key:7-8 ,Value:false
    Key:7-9 ,Value:false
    Key:7-10 ,Value:false
    Key:7-11 ,Value:false
    Key:7-12 ,Value:false
    Key:7-13 ,Value:false
    Key:7-14 ,Value:false
    Key:7-15 ,Value:false
    Key:7-16 ,Value:false
    Key:8-1 ,Value:false
    Key:8-2 ,Value:false
    Key:8-3 ,Value:false
    Key:8-4 ,Value:true
    Key:8-5 ,Value:false
    Key:8-6 ,Value:false
    Key:8-7 ,Value:false
    Key:8-9 ,Value:false
    Key:8-10 ,Value:false
    Key:8-11 ,Value:false
    Key:8-12 ,Value:false
    Key:8-13 ,Value:false
    Key:8-14 ,Value:false
    Key:8-15 ,Value:false
    Key:8-16 ,Value:false
    Key:9-1 ,Value:false
    Key:9-2 ,Value:false
    Key:9-3 ,Value:false
    Key:9-4 ,Value:true
    Key:9-5 ,Value:false
    Key:9-6 ,Value:false
    Key:9-7 ,Value:false
    Key:9-8 ,Value:false
    Key:9-10 ,Value:false
    Key:9-11 ,Value:false
    Key:9-12 ,Value:false
    Key:9-13 ,Value:false
    Key:9-14 ,Value:false
    Key:9-15 ,Value:false
    Key:9-16 ,Value:false
    Key:10-1 ,Value:false
    Key:10-2 ,Value:false
    Key:10-3 ,Value:false
    Key:10-4 ,Value:true
    Key:10-5 ,Value:false
    Key:10-6 ,Value:false
    Key:10-7 ,Value:false
    Key:10-8 ,Value:false
    Key:10-9 ,Value:false
    Key:10-11 ,Value:false
    Key:10-12 ,Value:false
    Key:10-13 ,Value:false
    Key:10-14 ,Value:false
    Key:10-15 ,Value:false
    Key:10-16 ,Value:false
    Key:11-1 ,Value:false
    Key:11-2 ,Value:false
    Key:11-3 ,Value:false
    Key:11-4 ,Value:true
    Key:11-5 ,Value:false
    Key:11-6 ,Value:false
    Key:11-7 ,Value:false
    Key:11-8 ,Value:false
    Key:11-9 ,Value:false
    Key:11-10 ,Value:false
    Key:11-12 ,Value:false
    Key:11-13 ,Value:false
    Key:11-14 ,Value:false
    Key:11-15 ,Value:false
    Key:11-16 ,Value:false
    Key:12-1 ,Value:false
    Key:12-2 ,Value:false
    Key:12-3 ,Value:false
    Key:12-4 ,Value:true
    Key:12-5 ,Value:false
    Key:12-6 ,Value:false
    Key:12-7 ,Value:false
    Key:12-8 ,Value:false
    Key:12-9 ,Value:false
    Key:12-10 ,Value:false
    Key:12-11 ,Value:false
    Key:12-13 ,Value:false
    Key:12-14 ,Value:false
    Key:12-15 ,Value:false
    Key:12-16 ,Value:false
    Key:13-1 ,Value:false
    Key:13-2 ,Value:false
    Key:13-3 ,Value:false
    Key:13-4 ,Value:true
    Key:13-5 ,Value:false
    Key:13-6 ,Value:false
    Key:13-7 ,Value:false
    Key:13-8 ,Value:false
    Key:13-9 ,Value:false
    Key:13-10 ,Value:false
    Key:13-11 ,Value:false
    Key:13-12 ,Value:false
    Key:13-14 ,Value:false
    Key:13-15 ,Value:false
    Key:13-16 ,Value:false
    Key:14-1 ,Value:false
    Key:14-2 ,Value:false
    Key:14-3 ,Value:false
    Key:14-4 ,Value:true
    Key:14-5 ,Value:false
    Key:14-6 ,Value:false
    Key:14-7 ,Value:false
    Key:14-8 ,Value:false
    Key:14-9 ,Value:false
    Key:14-10 ,Value:false
    Key:14-11 ,Value:false
    Key:14-12 ,Value:false
    Key:14-13 ,Value:false
    Key:14-15 ,Value:false
    Key:14-16 ,Value:false
    Key:15-1 ,Value:false
    Key:15-2 ,Value:false
    Key:15-3 ,Value:false
    Key:15-4 ,Value:true
    Key:15-5 ,Value:false
    Key:15-6 ,Value:false
    Key:15-7 ,Value:false
    Key:15-8 ,Value:false
    Key:15-9 ,Value:false
    Key:15-10 ,Value:false
    Key:15-11 ,Value:false
    Key:15-12 ,Value:false
    Key:15-13 ,Value:false
    Key:15-14 ,Value:false
    Key:15-16 ,Value:false
    Key:16-1 ,Value:false
    Key:16-2 ,Value:false
    Key:16-3 ,Value:false
    Key:16-4 ,Value:true
    Key:16-5 ,Value:false
    Key:16-6 ,Value:false
    Key:16-7 ,Value:false
    Key:16-8 ,Value:false
    Key:16-9 ,Value:false
    Key:16-10 ,Value:false
    Key:16-11 ,Value:false
    Key:16-12 ,Value:false
    Key:16-13 ,Value:false
    Key:16-14 ,Value:false
    Key:16-15 ,Value:false
    
    import java.util.TreeMap;
    import java.lang.*;
    
    public class Main {
    
      static TreeMap<Position, Boolean> booleanMap = new TreeMap<>();
       
      static public class Position implements Comparable<Position> {
    
        private final int x;
        private final int y;
    
        public Position(final int x, final int y) {
            this.x = x;
            this.y = y;
        }
    
        public int getX() {
            return x;
        }
    
        public int getY() {
            return y;
        }
    
        @Override
        public int compareTo(final Position o) {
            final int res = Integer.compare(getX(), o.getX());
            return (res != 0) ? res : Integer.compare(getY(), o.getY());
        }
    
        @Override
        public String toString() {
            return x + "-" + y;
        }
    }
    
      public static void main(String[] args) {
      
        //all values of symmetric matrix without diagonal axis
    
        int max = 16;
        int basicL = 4;
    
       for (int i = 1; i <= max; i++) {
         for (int j = 1; j <= max; j++) {
            if (j != i) {
                booleanMap.put(new Position(i, j), Boolean.FALSE);
              }
             }
            }
    
        System.out.println("-----------------------------------------------------");
        System.out.println("TreeMap has size:  " + booleanMap.size());
        System.out.println("TreeMap values:    " + booleanMap.values());
        System.out.println("TreeMap keySet:    " + booleanMap.keySet());
        System.out.println("-----------------------------------------------------");
    
        // setting true-conditions
    
       for (int i = 1; i <= max; i++) {
        for (int j = 1; j <= max; j++) {
            if ((i != basicL && j == basicL) || (i == basicL && j != i)) {
                booleanMap.replace(new Position(i, j), Boolean.TRUE);
            }
        }
    }  
    
        System.out.println("TreeMap values after looping:    " + booleanMap.values());
        System.out.println("TreeMap keySet after looping:    " + booleanMap.keySet());
        System.out.println("-----------------------------------------------------");
        
      }
    }
    
    TreeMap has size:  240
    TreeMap values:    [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false]
    TreeMap keySet:    [1-2, 1-3, 1-4, 1-5, 1-6, 1-7, 1-8, 1-9, 1-10, 1-11, 1-12, 1-13, 1-14, 1-15, 1-16, 2-1, 2-3, 2-4, 2-5, 2-6, 2-7, 2-8, 2-9, 2-10, 2-11, 2-12, 2-13, 2-14, 2-15, 2-16, 3-1, 3-2, 3-4, 3-5, 3-6, 3-7, 3-8, 3-9, 3-10, 3-11, 3-12, 3-13, 3-14, 3-15, 3-16, 4-1, 4-2, 4-3, 4-5, 4-6, 4-7, 4-8, 4-9, 4-10, 4-11, 4-12, 4-13, 4-14, 4-15, 4-16, 5-1, 5-2, 5-3, 5-4, 5-6, 5-7, 5-8, 5-9, 5-10, 5-11, 5-12, 5-13, 5-14, 5-15, 5-16, 6-1, 6-2, 6-3, 6-4, 6-5, 6-7, 6-8, 6-9, 6-10, 6-11, 6-12, 6-13, 6-14, 6-15, 6-16, 7-1, 7-2, 7-3, 7-4, 7-5, 7-6, 7-8, 7-9, 7-10, 7-11, 7-12, 7-13, 7-14, 7-15, 7-16, 8-1, 8-2, 8-3, 8-4, 8-5, 8-6, 8-7, 8-9, 8-10, 8-11, 8-12, 8-13, 8-14, 8-15, 8-16, 9-1, 9-2, 9-3, 9-4, 9-5, 9-6, 9-7, 9-8, 9-10, 9-11, 9-12, 9-13, 9-14, 9-15, 9-16, 10-1, 10-2, 10-3, 10-4, 10-5, 10-6, 10-7, 10-8, 10-9, 10-11, 10-12, 10-13, 10-14, 10-15, 10-16, 11-1, 11-2, 11-3, 11-4, 11-5, 11-6, 11-7, 11-8, 11-9, 11-10, 11-12, 11-13, 11-14, 11-15, 11-16, 12-1, 12-2, 12-3, 12-4, 12-5, 12-6, 12-7, 12-8, 12-9, 12-10, 12-11, 12-13, 12-14, 12-15, 12-16, 13-1, 13-2, 13-3, 13-4, 13-5, 13-6, 13-7, 13-8, 13-9, 13-10, 13-11, 13-12, 13-14, 13-15, 13-16, 14-1, 14-2, 14-3, 14-4, 14-5, 14-6, 14-7, 14-8, 14-9, 14-10, 14-11, 14-12, 14-13, 14-15, 14-16, 15-1, 15-2, 15-3, 15-4, 15-5, 15-6, 15-7, 15-8, 15-9, 15-10, 15-11, 15-12, 15-13, 15-14, 15-16, 16-1, 16-2, 16-3, 16-4, 16-5, 16-6, 16-7, 16-8, 16-9, 16-10, 16-11, 16-12, 16-13, 16-14, 16-15]
    -----------------------------------------------------
    TreeMap values after looping:    [false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false]
    TreeMap keySet after looping:    [1-2, 1-3, 1-4, 1-5, 1-6, 1-7, 1-8, 1-9, 1-10, 1-11, 1-12, 1-13, 1-14, 1-15, 1-16, 2-1, 2-3, 2-4, 2-5, 2-6, 2-7, 2-8, 2-9, 2-10, 2-11, 2-12, 2-13, 2-14, 2-15, 2-16, 3-1, 3-2, 3-4, 3-5, 3-6, 3-7, 3-8, 3-9, 3-10, 3-11, 3-12, 3-13, 3-14, 3-15, 3-16, 4-1, 4-2, 4-3, 4-5, 4-6, 4-7, 4-8, 4-9, 4-10, 4-11, 4-12, 4-13, 4-14, 4-15, 4-16, 5-1, 5-2, 5-3, 5-4, 5-6, 5-7, 5-8, 5-9, 5-10, 5-11, 5-12, 5-13, 5-14, 5-15, 5-16, 6-1, 6-2, 6-3, 6-4, 6-5, 6-7, 6-8, 6-9, 6-10, 6-11, 6-12, 6-13, 6-14, 6-15, 6-16, 7-1, 7-2, 7-3, 7-4, 7-5, 7-6, 7-8, 7-9, 7-10, 7-11, 7-12, 7-13, 7-14, 7-15, 7-16, 8-1, 8-2, 8-3, 8-4, 8-5, 8-6, 8-7, 8-9, 8-10, 8-11, 8-12, 8-13, 8-14, 8-15, 8-16, 9-1, 9-2, 9-3, 9-4, 9-5, 9-6, 9-7, 9-8, 9-10, 9-11, 9-12, 9-13, 9-14, 9-15, 9-16, 10-1, 10-2, 10-3, 10-4, 10-5, 10-6, 10-7, 10-8, 10-9, 10-11, 10-12, 10-13, 10-14, 10-15, 10-16, 11-1, 11-2, 11-3, 11-4, 11-5, 11-6, 11-7, 11-8, 11-9, 11-10, 11-12, 11-13, 11-14, 11-15, 11-16, 12-1, 12-2, 12-3, 12-4, 12-5, 12-6, 12-7, 12-8, 12-9, 12-10, 12-11, 12-13, 12-14, 12-15, 12-16, 13-1, 13-2, 13-3, 13-4, 13-5, 13-6, 13-7, 13-8, 13-9, 13-10, 13-11, 13-12, 13-14, 13-15, 13-16, 14-1, 14-2, 14-3, 14-4, 14-5, 14-6, 14-7, 14-8, 14-9, 14-10, 14-11, 14-12, 14-13, 14-15, 14-16, 15-1, 15-2, 15-3, 15-4, 15-5, 15-6, 15-7, 15-8, 15-9, 15-10, 15-11, 15-12, 15-13, 15-14, 15-16, 16-1, 16-2, 16-3, 16-4, 16-5, 16-6, 16-7, 16-8, 16-9, 16-10, 16-11, 16-12, 16-13, 16-14, 16-15]
    -----------------------------------------------------