public static List<Versioned<byte[]>> resolveVersions(List<Versioned<byte[]>> values) {
        List<Versioned<byte[]>> resolvedVersions = new ArrayList<Versioned<byte[]>>(values.size());
        // Go over all the values and determine whether the version is
        // acceptable
        for(Versioned<byte[]> value: values) {
            Iterator<Versioned<byte[]>> iter = resolvedVersions.iterator();
            boolean obsolete = false;
            // Compare the current version with a set of accepted versions
            while(iter.hasNext()) {
                Versioned<byte[]> curr = iter.next();
                Occurred occurred = value.getVersion().compare(curr.getVersion());
                if(occurred == Occurred.BEFORE) {
                    obsolete = true;
                    break;
                } else if(occurred == Occurred.AFTER) {
                    iter.remove();
                }
            }
            if(!obsolete) {
                // else update the set of accepted versions
                resolvedVersions.add(value);
            }
        }

        return resolvedVersions;
    }
public static List < Versioned < byte [ ] > > resolveVersions ( List < Versioned < byte [ ] > > values ) { List < Versioned < byte [ ] > > resolvedVersions = new ArrayList < Versioned < byte [ ] > > ( values . size ( ) ) ; for ( Versioned < byte [ ] > value : values ) { Iterator < Versioned < byte [ ] > > iter = resolvedVersions . iterator ( ) ; boolean obsolete = false ; while ( iter . hasNext ( ) ) { Versioned < byte [ ] > curr = iter . next ( ) ; Occurred occurred = value . getVersion ( ) . compare ( curr . getVersion ( ) ) ; if ( occurred == Occurred . BEFORE ) { obsolete = true ; break ; } else if ( occurred == Occurred . AFTER ) { iter . remove ( ) ; } } if ( ! obsolete ) { resolvedVersions . add ( value ) ; } } return resolvedVersions ; }
Given a set of versions, constructs a resolved list of versions based on
the compare function above

@param values
@return list of values after resolution