6 Mayıs 2020 Çarşamba

TreeBasedTable Sınıfı

create metodu
Örnek
Şöyle yaparız
RowSortedTable<String, String, Double> graph = TreeBasedTable.create();
putAll metodu
Şöyle yaparız
// Create sample HashBasedTable
Table<Integer, Integer, String> hashBasedTable = HashBasedTable.create();
hashBasedTable.put(1, 1, "eleven");
hashBasedTable.put(4, 2, "forty two");
hashBasedTable.put(2, 4, "twenty four");
hashBasedTable.put(1, 4, "fourteen");
  // {1={1=eleven, 4=fourteen}, 4={2=forty two}, 2={4=twenty four}}

// Create TreeBasedTable (with natural ordering,
// use `.create(Comparator, Comparator)` otherwise)
TreeBasedTable<Integer, Integer, String> treeBasedTable = TreeBasedTable.create();
treeBasedTable.putAll(hashBasedTable);
System.out.println(treeBasedTable);
  // {1={1=eleven, 4=fourteen}, 2={4=twenty four}, 4={2=forty two}}

Hiç yorum yok:

Yorum Gönder