Skip to content

Commit

Permalink
Combine immutability type fixes. (#3)
Browse files Browse the repository at this point in the history
* Update Schema.java

The type sets are final mutable types, but with immutable implementations. This doesn't communicate the desired semantic guarantees of the immutable implementation.

* Remove unneeded collection import.
  • Loading branch information
lostluck authored Jun 7, 2018
1 parent 0e90776 commit c4e6560
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
Expand Down Expand Up @@ -222,13 +221,13 @@ public enum TypeName {
MAP,
ROW; // The field is itself a nested row.

public static final Set<TypeName> NUMERIC_TYPES = ImmutableSet.of(
public static final ImmutableSet<TypeName> NUMERIC_TYPES = ImmutableSet.of(
BYTE, INT16, INT32, INT64, DECIMAL, FLOAT, DOUBLE);
public static final Set<TypeName> STRING_TYPES = ImmutableSet.of(STRING);
public static final Set<TypeName> DATE_TYPES = ImmutableSet.of(DATETIME);
public static final Set<TypeName> COLLECTION_TYPES = ImmutableSet.of(ARRAY);
public static final Set<TypeName> MAP_TYPES = ImmutableSet.of(MAP);
public static final Set<TypeName> COMPOSITE_TYPES = ImmutableSet.of(ROW);
public static final ImmutableSet<TypeName> STRING_TYPES = ImmutableSet.of(STRING);
public static final ImmutableSet<TypeName> DATE_TYPES = ImmutableSet.of(DATETIME);
public static final ImmutableSet<TypeName> COLLECTION_TYPES = ImmutableSet.of(ARRAY);
public static final ImmutableSet<TypeName> MAP_TYPES = ImmutableSet.of(MAP);
public static final ImmutableSet<TypeName> COMPOSITE_TYPES = ImmutableSet.of(ROW);

public boolean isPrimitiveType() {
return !isCollectionType() && !isMapType() && !isCompositeType();
Expand Down

0 comments on commit c4e6560

Please sign in to comment.