public List < NodeValue < K , V > > getRepairs ( List < NodeValue < K , V > > nodeValues ) { int size = nodeValues . size ( ) ; if ( size <= 1 ) return Collections . emptyList ( ) ; Map < K , List < NodeValue < K , V > > > keyToNodeValues = Maps . newHashMap ( ) ; for ( NodeValue < K , V > nodeValue : nodeValues ) { List < NodeValue < K , V > > keyNodeValues = keyToNodeValues . get ( nodeValue . getKey ( ) ) ; if ( keyNodeValues == null ) { keyNodeValues = Lists . newArrayListWithCapacity ( 5 ) ; keyToNodeValues . put ( nodeValue . getKey ( ) , keyNodeValues ) ; } keyNodeValues . add ( nodeValue ) ; } List < NodeValue < K , V > > result = Lists . newArrayList ( ) ; for ( List < NodeValue < K , V > > keyNodeValues : keyToNodeValues . values ( ) ) result . addAll ( singleKeyGetRepairs ( keyNodeValues ) ) ; return result ; }
Compute the repair set from the given values and nodes