List of usage examples for com.google.common.collect ImmutableSortedSet of
public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(E element)
From source file:org.apache.shindig.social.sample.spi.JsonDbOpensocialService.java
private Set<String> getIdSet(UserId user, GroupId group, SecurityToken token) throws JSONException { String userId = user.getUserId(token); if (group == null) { return ImmutableSortedSet.of(userId); }/* w w w .j a v a2s . c om*/ Set<String> returnVal = Sets.newLinkedHashSet(); switch (group.getType()) { case all: case friends: case groupId: if (db.getJSONObject(FRIEND_LINK_TABLE).has(userId)) { JSONArray friends = db.getJSONObject(FRIEND_LINK_TABLE).getJSONArray(userId); for (int i = 0; i < friends.length(); i++) { returnVal.add(friends.getString(i)); } } break; case self: returnVal.add(userId); break; } return returnVal; }
From source file:com.facebook.buck.cxx.CxxDescriptionEnhancer.java
public static CxxStrip createCxxStripRule(BuildRuleParams params, BuildRuleResolver resolver, StripStyle stripStyle, SourcePathResolver sourcePathResolver, BuildRule unstrippedBinaryRule, CxxPlatform cxxPlatform) {//from w w w.ja v a 2s .com BuildRuleParams stripRuleParams = params.copyWithChanges( params.getBuildTarget().withAppendedFlavors(CxxStrip.RULE_FLAVOR, stripStyle.getFlavor()), Suppliers.ofInstance(ImmutableSortedSet.of(unstrippedBinaryRule)), Suppliers.ofInstance(ImmutableSortedSet.of())); Optional<BuildRule> exisitingRule = resolver.getRuleOptional(stripRuleParams.getBuildTarget()); if (exisitingRule.isPresent()) { Preconditions.checkArgument(exisitingRule.get() instanceof CxxStrip); return (CxxStrip) exisitingRule.get(); } else { CxxStrip cxxStrip = new CxxStrip(stripRuleParams, sourcePathResolver, stripStyle, new BuildTargetSourcePath(unstrippedBinaryRule.getBuildTarget()), cxxPlatform.getStrip(), CxxDescriptionEnhancer.getBinaryOutputPath(stripRuleParams.getBuildTarget(), params.getProjectFilesystem(), cxxPlatform.getBinaryExtension())); resolver.addToIndex(cxxStrip); return cxxStrip; } }