protected static int compareIndices(Map indexMap,Object obj1,Object obj2,Integer fallbackIndex){
  Integer index1=(Integer)indexMap.get(obj1);
  Integer index2=(Integer)indexMap.get(obj2);
  if (index1 == null) {
    index1=fallbackIndex;
  }
  if (index2 == null) {
    index2=fallbackIndex;
  }
  return index1.compareTo(index2);
}

protected static int compareIndices ( Map indexMap , Object obj1 , Object obj2 , Integer fallbackIndex ) { Integer index1 = ( Integer ) indexMap . get ( obj1 ) ; Integer index2 = ( Integer ) indexMap . get ( obj2 ) ; if ( index1 == null ) { index1 = fallbackIndex ; } if ( index2 == null ) { index2 = fallbackIndex ; } return index1 . compareTo ( index2 ) ; }
helper method to compare two objects by their integer indices in the given map . if the map doesn ' t contain an entry for either of the objects , the fallback index will be used for the object instead .
