MCPcopy Index your code
hub / github.com/antlr/codebuff / asImmutable

Method asImmutable

output/java_guava/1.4.18/ImmutableEnumSet.java:35–45  ·  view source on GitHub ↗
(EnumSet set)

Source from the content-addressed store, hash-verified

33@SuppressWarnings("serial") // we're overriding default serialization
34final class ImmutableEnumSet<E extends Enum<E>> extends ImmutableSet<E> {
35 @SuppressWarnings("rawtypes") // necessary to compile against Java 8
36 static ImmutableSet asImmutable(EnumSet set) {
37 switch (set.size()) {
38 case 0:
39 return ImmutableSet.of();
40 case 1:
41 return ImmutableSet.of(Iterables.getOnlyElement(set));
42 default:
43 return new ImmutableEnumSet(set);
44 }
45 }
46
47 /*
48 * Notes on EnumSet and <E extends Enum<E>>:

Callers 2

copyOfEnumSetMethod · 0.95
immutableEnumSetMethod · 0.95

Calls 3

ofMethod · 0.95
getOnlyElementMethod · 0.95
sizeMethod · 0.65

Tested by

no test coverage detected