public static EnumSet<Side> getSides(final byte sidesBit) { final List<Side> result = Lists.newArrayList(); sideBits.forEachEntry( (a, b) -> { if ((b & sidesBit) > 0) { result.add(a); } return true; }); return Sets.newEnumSet(result, Side.class); }
public void testNewEnumSet_collection() { Set<SomeEnum> set = ImmutableSet.of(SomeEnum.B, SomeEnum.C); assertEquals(set, newEnumSet(set, SomeEnum.class)); }
public void testNewEnumSet_empty() { EnumSet<SomeEnum> copy = newEnumSet(Collections.<SomeEnum>emptySet(), SomeEnum.class); assertEquals(EnumSet.noneOf(SomeEnum.class), copy); }
public void testNewEnumSet_enumSet() { EnumSet<SomeEnum> set = EnumSet.of(SomeEnum.A, SomeEnum.D); assertEquals(set, newEnumSet(set, SomeEnum.class)); }
public void testNewEnumSet_iterable() { Set<SomeEnum> set = ImmutableSet.of(SomeEnum.A, SomeEnum.B, SomeEnum.C); assertEquals(set, newEnumSet(unmodifiableIterable(set), SomeEnum.class)); }
public Options(OptionBeans... options) { this.oakRunOptions = Sets.newEnumSet(asList(options), OptionBeans.class); }
public Options(OptionBeans... options) { this.oakRunOptions = Sets.newEnumSet(asList(options), OptionBeans.class); }
private Set<ApplinksCapabilities> getCapabilities(Response response) throws ResponseException { @SuppressWarnings("unchecked") Iterable<String> stringCapabilities = response.getEntity(List.class); Iterable<ApplinksCapabilities> enumCapabilities = transform(stringCapabilities, fromNameSafe(ApplinksCapabilities.class)); return Sets.newEnumSet(filter(enumCapabilities, Predicates.notNull()), ApplinksCapabilities.class); } }
@Override protected void setup(Context context) throws IOException, InterruptedException { super.setup(context); this.dstRoot = new Path(context.getConfiguration().get(DST_PATH_CONF)).toUri(); this.underDstRootPred = new Predicate<SimpleFileStatus>() { @Override public boolean apply(@Nullable SimpleFileStatus simpleFileStatus) { return !dstRoot.relativize(simpleFileStatus.getUri()) .equals(simpleFileStatus.getUri()); } }; this.operationSet = Sets.newEnumSet( Iterables.<String, Operation>transform( Arrays.asList(context.getConfiguration().get(COMPARE_OPTION_CONF, "a,d,u") .split(",")), new Function<String, Operation>() { @Override public Operation apply(@Nullable String value) { return Operation.getEnum(value); } }), Operation.class); this.rootUris = Stream.concat( Stream.of(context.getConfiguration().get(DST_PATH_CONF)), Stream.of(context.getConfiguration().get(SRC_PATH_CONF).split(","))).map( root -> new Path(root).toUri()).toArray(size -> new URI[size] ); }
@Override protected void setup(Context context) throws IOException, InterruptedException { super.setup(context); this.dstRoot = new Path(context.getConfiguration().get(DST_PATH_CONF)).toUri(); this.underDstRootPred = new Predicate<SimpleFileStatus>() { @Override public boolean apply(@Nullable SimpleFileStatus simpleFileStatus) { return !dstRoot.relativize(simpleFileStatus.getUri()) .equals(simpleFileStatus.getUri()); } }; this.operationSet = Sets.newEnumSet( Iterables.<String, Operation>transform( Arrays.asList(context.getConfiguration().get(COMPARE_OPTION_CONF, "a,d,u") .split(",")), new Function<String, Operation>() { @Override public Operation apply(@Nullable String value) { return Operation.getEnum(value); } }), Operation.class); this.rootUris = Stream.concat( Stream.of(context.getConfiguration().get(DST_PATH_CONF)), Stream.of(context.getConfiguration().get(SRC_PATH_CONF).split(","))).map( root -> new Path(root).toUri()).toArray(size -> new URI[size] ); }
public void testNewEnumSet_empty() { EnumSet<SomeEnum> copy = newEnumSet(Collections.<SomeEnum>emptySet(), SomeEnum.class); assertEquals(EnumSet.noneOf(SomeEnum.class), copy); }
public void testNewEnumSet_enumSet() { EnumSet<SomeEnum> set = EnumSet.of(SomeEnum.A, SomeEnum.D); assertEquals(set, newEnumSet(set, SomeEnum.class)); }
public void testNewEnumSet_collection() { Set<SomeEnum> set = ImmutableSet.of(SomeEnum.B, SomeEnum.C); assertEquals(set, newEnumSet(set, SomeEnum.class)); }
super(user.getId()); this.root = user.isRoot(); this.global = newEnumSet(flatten(user.getGlobalRoles(), user.getGlobalAuthorities()), GlobalAuthority.class); if (!user.getPortalAuthorities().isEmpty()) { final Map<UUID, EnumSet<PortalAuthority>> portalMap = Maps.newHashMap();
public void testNewEnumSet_iterable() { Set<SomeEnum> set = ImmutableSet.of(SomeEnum.A, SomeEnum.B, SomeEnum.C); assertEquals(set, newEnumSet(unmodifiableIterable(set), SomeEnum.class)); }
Set<EntityType> types = Sets.newEnumSet(Arrays.asList(requirements.types()), EntityType.class); if (types.contains(EntityType.UNKNOWN)) { types = EnumSet.allOf(EntityType.class);