public MapRDBIndexDescriptor(List<LogicalExpression> indexCols, CollationContext indexCollationContext, List<LogicalExpression> nonIndexCols, List<LogicalExpression> rowKeyColumns, String indexName, String tableName, IndexType type, Object desc, DbGroupScan scan, NullDirection nullsDirection) { super(indexCols, indexCollationContext, nonIndexCols, rowKeyColumns, indexName, tableName, type, nullsDirection); this.desc = desc; this.indexedFields = ImmutableSet.copyOf(indexColumns); this.allFields = new ImmutableSet.Builder<LogicalExpression>() .add(PluginConstants.DOCUMENT_SCHEMA_PATH) .addAll(indexColumns) .addAll(nonIndexColumns) .build(); this.pluginCost = scan.getPluginCostModel(); }
/** * Returns an immutable copy of the current contents of this set view. * Does not support null elements. * * <p><b>Warning:</b> this may have unexpected results if a backing set of * this view uses a nonstandard notion of equivalence, for example if it is * a {@link TreeSet} using a comparator that is inconsistent with {@link * Object#equals(Object)}. */ public ImmutableSet<E> immutableCopy() { return ImmutableSet.copyOf(this); }
Object readResolve() { return copyOf(elements); }
/** * Returns an immutable set containing each of {@code elements}, minus duplicates, in the order * each appears first in the source iterable. This method iterates over {@code elements} only * once. * * <p><b>Performance note:</b> This method will sometimes recognize that the actual copy operation * is unnecessary; for example, {@code copyOf(copyOf(anArrayList))} should copy the data only * once. This reduces the expense of habitually making defensive copies at API boundaries. * However, the precise conditions for skipping the copy operation are undefined. * * @throws NullPointerException if any of {@code elements} is null */ public static <E> ImmutableSet<E> copyOf(Iterable<? extends E> elements) { return (elements instanceof Collection) ? copyOf((Collection<? extends E>) elements) : copyOf(elements.iterator()); }
private static <V> ImmutableSet<V> valueSet( @Nullable Comparator<? super V> valueComparator, Collection<? extends V> values) { return (valueComparator == null) ? ImmutableSet.copyOf(values) : ImmutableSortedSet.copyOf(valueComparator, values); }
private FileByteSink(File file, FileWriteMode... modes) { this.file = checkNotNull(file); this.modes = ImmutableSet.copyOf(modes); }
/** * Returns an {@code ImmutableSet} containing all of the elements from this fluent iterable with * duplicates removed. * * <p><b>{@code Stream} equivalent:</b> pass {@link ImmutableSet#toImmutableSet} to {@code * stream.collect()}. * * @throws NullPointerException if any element is {@code null} * @since 14.0 (since 12.0 as {@code toImmutableSet()}). */ public final ImmutableSet<E> toSet() { return ImmutableSet.copyOf(getDelegate()); }
private static final <R, C, V> RegularImmutableTable<R, C, V> forCellsInternal( Iterable<Cell<R, C, V>> cells, @Nullable Comparator<? super R> rowComparator, @Nullable Comparator<? super C> columnComparator) { Set<R> rowSpaceBuilder = new LinkedHashSet<R>(); Set<C> columnSpaceBuilder = new LinkedHashSet<C>(); ImmutableList<Cell<R, C, V>> cellList = ImmutableList.copyOf(cells); for (Cell<R, C, V> cell : cells) { rowSpaceBuilder.add(cell.getRowKey()); columnSpaceBuilder.add(cell.getColumnKey()); } ImmutableSet<R> rowSpace = (rowComparator == null) ? ImmutableSet.copyOf(rowSpaceBuilder) : ImmutableSet.copyOf(ImmutableList.sortedCopyOf(rowComparator, rowSpaceBuilder)); ImmutableSet<C> columnSpace = (columnComparator == null) ? ImmutableSet.copyOf(columnSpaceBuilder) : ImmutableSet.copyOf(ImmutableList.sortedCopyOf(columnComparator, columnSpaceBuilder)); return forOrderedComponents(cellList, rowSpace, columnSpace); }
@Override public ParallelizationInfo getReceiverParallelizationInfo(List<DrillbitEndpoint> senderFragmentEndpoints) { Preconditions.checkArgument(senderFragmentEndpoints != null && senderFragmentEndpoints.size() > 0, "Sender fragment endpoint list should not be empty"); // We want to run one mux receiver per Drillbit endpoint. // Identify the number of unique Drillbit endpoints in sender fragment endpoints. List<DrillbitEndpoint> drillbitEndpoints = ImmutableSet.copyOf(senderFragmentEndpoints).asList(); List<EndpointAffinity> affinities = Lists.newArrayList(); for(DrillbitEndpoint ep : drillbitEndpoints) { affinities.add(new EndpointAffinity(ep, Double.POSITIVE_INFINITY)); } return ParallelizationInfo.create(affinities.size(), affinities.size(), affinities); }
@Override public ParallelizationInfo getSenderParallelizationInfo(List<DrillbitEndpoint> receiverFragmentEndpoints) { Preconditions.checkArgument(receiverFragmentEndpoints != null && receiverFragmentEndpoints.size() > 0, "Receiver fragment endpoint list should not be empty"); // We want to run one demux sender per Drillbit endpoint. // Identify the number of unique Drillbit endpoints in receiver fragment endpoints. List<DrillbitEndpoint> drillbitEndpoints = ImmutableSet.copyOf(receiverFragmentEndpoints).asList(); List<EndpointAffinity> affinities = Lists.newArrayList(); for(DrillbitEndpoint ep : drillbitEndpoints) { affinities.add(new EndpointAffinity(ep, Double.POSITIVE_INFINITY)); } return ParallelizationInfo.create(affinities.size(), affinities.size(), affinities); }
@SuppressWarnings("RedundantTypeArguments") @Override public ImmutableSet<Class<?>> load(Class<?> concreteClass) { return ImmutableSet.<Class<?>>copyOf( TypeToken.of(concreteClass).getTypes().rawTypes()); } });
return RuleSets.ofList(ImmutableSet.copyOf(ruleList));
Object readResolve() { if (cellValues.length == 0) { return of(); } if (cellValues.length == 1) { return of(rowKeys[0], columnKeys[0], cellValues[0]); } ImmutableList.Builder<Cell<Object, Object, Object>> cellListBuilder = new ImmutableList.Builder<Cell<Object, Object, Object>>(cellValues.length); for (int i = 0; i < cellValues.length; i++) { cellListBuilder.add( cellOf(rowKeys[cellRowIndices[i]], columnKeys[cellColumnIndices[i]], cellValues[i])); } return RegularImmutableTable.forOrderedComponents( cellListBuilder.build(), ImmutableSet.copyOf(rowKeys), ImmutableSet.copyOf(columnKeys)); }
public MapRDBIndexDescriptor(List<LogicalExpression> indexCols, CollationContext indexCollationContext, List<LogicalExpression> nonIndexCols, List<LogicalExpression> rowKeyColumns, String indexName, String tableName, IndexType type, Object desc, DbGroupScan scan, NullDirection nullsDirection) { super(indexCols, indexCollationContext, nonIndexCols, rowKeyColumns, indexName, tableName, type, nullsDirection); this.desc = desc; this.indexedFields = ImmutableSet.copyOf(indexColumns); this.allFields = new ImmutableSet.Builder<LogicalExpression>() .add(PluginConstants.DOCUMENT_SCHEMA_PATH) .addAll(indexColumns) .addAll(nonIndexColumns) .build(); this.pluginCost = scan.getPluginCostModel(); }
static <E> Set<List<E>> create(List<? extends Set<? extends E>> sets) { ImmutableList.Builder<ImmutableSet<E>> axesBuilder = new ImmutableList.Builder<ImmutableSet<E>>(sets.size()); for (Set<? extends E> set : sets) { ImmutableSet<E> copy = ImmutableSet.copyOf(set); if (copy.isEmpty()) { return ImmutableSet.of(); } axesBuilder.add(copy); } final ImmutableList<ImmutableSet<E>> axes = axesBuilder.build(); ImmutableList<List<E>> listAxes = new ImmutableList<List<E>>() { @Override public int size() { return axes.size(); } @Override public List<E> get(int index) { return axes.get(index).asList(); } @Override boolean isPartialView() { return true; } }; return new CartesianSet<E>(axes, new CartesianList<E>(listAxes)); }