@Test public void testGetGroupIndex() { KeyToGroupMap m1 = new KeyToGroupMap("Default Group"); assertEquals(0, m1.getGroupIndex("Default Group")); assertEquals(-1, m1.getGroupIndex("G3")); m1.mapKeyToGroup("K3", "G3"); m1.mapKeyToGroup("K1", "G1"); m1.mapKeyToGroup("K2", "G2"); assertEquals(1, m1.getGroupIndex("G3")); assertEquals(2, m1.getGroupIndex("G1")); assertEquals(3, m1.getGroupIndex("G2")); }
public int getGroupIndex(Comparable group) { int result = this.groups.indexOf(group); if (result < 0) { if (this.defaultGroup.equals(group)) { result = 0; } } else { result = result + 1; } return result; }
KeyToGroupMap implements Cloneable, PublicCloneable, Serializable { public int getGroupIndex(Comparable group) { int result = this.groups.indexOf(group); if (result < 0) { if (this.defaultGroup.equals(group)) { result = 0; } } else { result = result + 1; } return result; } }
KeyToGroupMap implements Cloneable, PublicCloneable, Serializable { public int getGroupIndex(Comparable group) { int result = this.groups.indexOf(group); if (result < 0) { if (this.defaultGroup.equals(group)) { result = 0; } } else { result = result + 1; } return result; } KeyToGroupMap();  KeyToGroupMap(Comparable defaultGroup); }
KeyToGroupMap implements Cloneable, PublicCloneable, Serializable { public int getGroupIndex(Comparable group) { int result = this.groups.indexOf(group); if (result < 0) { if (this.defaultGroup.equals(group)) { result = 0; } } else { result = result + 1; } return result; } KeyToGroupMap();  KeyToGroupMap(Comparable defaultGroup); int getGroupCount(); List<Comparable> getGroups(); int getGroupIndex(Comparable group); Comparable getGroup(Comparable key); void mapKeyToGroup(Comparable key, Comparable group); int getKeyCount(Comparable group); @Override boolean equals(Object obj); @Override Object clone(); }
KeyToGroupMap implements Cloneable, PublicCloneable, Serializable { public int getGroupIndex(Comparable group) { int result = this.groups.indexOf(group); if (result < 0) { if (this.defaultGroup.equals(group)) { result = 0; } } else { result = result + 1; } return result; } KeyToGroupMap();  KeyToGroupMap(Comparable defaultGroup); int getGroupCount(); List<Comparable> getGroups(); int getGroupIndex(Comparable group); Comparable getGroup(Comparable key); void mapKeyToGroup(Comparable key, Comparable group); int getKeyCount(Comparable group); @Override boolean equals(Object obj); @Override Object clone();  }