Using sorted static field set in EncodedArrayPool Key.

This commit is contained in:
Izzat Bahadirov 2013-03-31 01:53:57 -04:00
parent 1d4b31a11c
commit 8191cd9a7a

View File

@ -140,12 +140,13 @@ public class EncodedArrayPool {
@Nullable
public static Key of(@Nonnull ClassDef classDef) {
Set<? extends Field> staticFields = FluentIterable.from(classDef.getFields()).filter(IS_STATIC_FIELD).toSet();
Iterable<? extends Field> staticFieldsSorted = FluentIterable.from(staticFields).toSortedSet(new FieldComparator());
Set<? extends Field> staticFieldsSorted = FluentIterable.from(classDef.getFields())
.filter(IS_STATIC_FIELD)
.toSortedSet(new FieldComparator());
int lastIndex = CollectionUtils.lastIndexOf(staticFieldsSorted, HAS_INITIALIZER);
if (lastIndex > -1) {
return new Key(staticFields, lastIndex+1);
return new Key(staticFieldsSorted, lastIndex+1);
}
return null;
}