public static < C extends Compound > int indexOf ( Sequence < C > sequence , C compound ) { int index = 1 ; for ( C currentCompound : sequence ) { if ( currentCompound . equals ( compound ) ) { return index ; } index ++ ; } return 0 ; }
Performs a linear search of the given Sequence for the given compound . Once we find the compound we return the position .