AttributeComparator implements Comparator<Object> { public static List<IValue> toSortedValues( IEntry entry ) { return Arrays.stream( entry.getAttributes() ).flatMap( a -> Arrays.stream( a.getValues() ) ) .sorted( new AttributeComparator() ) .collect( Collectors.toList() ); } AttributeComparator();  AttributeComparator( int sortBy, int defaultSortBy, int sortOrder, int defaultSortOrder, boolean objectClassAndMustAttributesFirst,
        boolean operationalAttributesLast ); int compare( Object o1, Object o2 ); static List<IValue> toSortedValues( IEntry entry );  }
@Test public void test_DIRSTUDIO_1200() throws Exception { Schema schema = Schema.DEFAULT_SCHEMA; DummyConnection connection = new DummyConnection( schema ); LdifContentRecord record = new LdifContentRecord( LdifDnLine.create( "cn=foo" ) ); record.addAttrVal( LdifAttrValLine.create( "objectClass", "inetOrgPerson" ) ); for ( int i = 0; i < 28; i++ ) { record.addAttrVal( LdifAttrValLine.create( "uid", "" + i ) ); } record.addAttrVal( LdifAttrValLine.create( "objectClass", "top" ) ); record.addAttrVal( LdifAttrValLine.create( "cn", "foo" ) ); record.addAttrVal( LdifAttrValLine.create( "cn", "bar" ) ); DummyEntry entry = ModelConverter.ldifContentRecordToEntry( record, connection ); List<IValue> sortedValues = AttributeComparator.toSortedValues( entry ); assertEquals( 32, sortedValues.size() ); assertEquals( "objectClass", sortedValues.get( 0 ).getAttribute().getDescription() ); assertEquals( "inetOrgPerson", sortedValues.get( 0 ).getStringValue() ); assertEquals( "uid", sortedValues.get( 31 ).getAttribute().getDescription() ); assertEquals( "9", sortedValues.get( 31 ).getStringValue() ); }