List of usage examples for com.google.common.collect ImmutableSortedSet comparator
public Comparator<? super E> comparator()
From source file:com.facebook.buck.android.AndroidResourceHelper.java
/** * Filters out the set of {@code android_resource()} dependencies from {@code deps}. As a special * case, if an {@code android_prebuilt_aar()} appears in the deps, the {@code android_resource()} * that corresponds to the AAR will also be included in the output. * <p>//from w ww . ja v a 2 s. c o m */ public static ImmutableSortedSet<BuildRule> androidResOnly(ImmutableSortedSet<BuildRule> deps) { return FluentIterable.from(deps).transform(new Function<BuildRule, BuildRule>() { @Override @Nullable public BuildRule apply(BuildRule buildRule) { if (buildRule instanceof HasAndroidResourceDeps) { return buildRule; } return null; } }).filter(Objects::nonNull).toSortedSet(deps.comparator()); }
From source file:com.google.devtools.build.lib.skyframe.serialization.ImmutableSortedSetCodec.java
@Override public void serialize(SerializationContext context, ImmutableSortedSet<E> object, CodedOutputStream codedOut) throws SerializationException, IOException { context.serialize(object.comparator(), codedOut); codedOut.writeInt32NoTag(object.size()); for (Object obj : object) { context.serialize(obj, codedOut); }/*from w ww. j av a2 s .c o m*/ }