public int compare(GroupDelta object1, GroupDelta object2) { final Long id1 = object1.getId(); final Long id2 = object2.getId(); if (id1 == null && id2 == null) { return 0; } else if (id1 == null) { return -1; } else if (id2 == null) { return 1; } else if (id1 < id2) { return -1; } else if (id1 > id2) { return 1; } else { return 0; } }
@Override public long getChildId(int groupPosition, int childPosition) { final GroupDelta child = (GroupDelta) getChild(groupPosition, childPosition); if (child != null) { final Long childId = child.getId(); return childId != null ? childId : Long.MIN_VALUE; } else { return Long.MIN_VALUE; } }