Tabnine Logo
Sets.newHashSetWithExpectedSize
Code IndexAdd Tabnine to your IDE (free)

How to use
newHashSetWithExpectedSize
method
in
org.apache.drill.shaded.guava.com.google.common.collect.Sets

Best Java code snippets using org.apache.drill.shaded.guava.com.google.common.collect.Sets.newHashSetWithExpectedSize (Showing top 6 results out of 315)

origin: org.apache.drill/drill-shaded-guava

/**
 * {@inheritDoc}
 *
 * <p>Creates an empty {@code HashSet} for a collection of values for one key.
 *
 * @return a new {@code HashSet} containing a collection of values for one key
 */
@Override
Set<V> createCollection() {
 return Sets.<V>newHashSetWithExpectedSize(expectedValuesPerKey);
}
origin: org.apache.drill/drill-shaded-guava

 @Override
 public Set<V> get() {
  return Sets.newHashSetWithExpectedSize(expectedValuesPerKey);
 }
}
origin: org.apache.drill/drill-shaded-guava

/**
 * Creates a <i>mutable</i> {@code HashSet} instance initially containing the given elements.
 *
 * <p><b>Note:</b> if elements are non-null and won't be added or removed after this point, use
 * {@link ImmutableSet#of()} or {@link ImmutableSet#copyOf(Object[])} instead. If {@code E} is an
 * {@link Enum} type, use {@link EnumSet#of(Enum, Enum[])} instead. Otherwise, strongly consider
 * using a {@code LinkedHashSet} instead, at the cost of increased memory footprint, to get
 * deterministic iteration behavior.
 *
 * <p>This method is just a small convenience, either for {@code newHashSet(}{@link Arrays#asList
 * asList}{@code (...))}, or for creating an empty set then calling {@link Collections#addAll}.
 * This method is not actually very useful and will likely be deprecated in the future.
 */
public static <E> HashSet<E> newHashSet(E... elements) {
 HashSet<E> set = newHashSetWithExpectedSize(elements.length);
 Collections.addAll(set, elements);
 return set;
}
origin: org.apache.drill.exec/drill-java-exec

private static void ensureNoDuplicateColumnNames(List<String> fieldNames) throws ValidationException {
 final HashSet<String> fieldHashSet = Sets.newHashSetWithExpectedSize(fieldNames.size());
 for(String field : fieldNames) {
  if (fieldHashSet.contains(field.toLowerCase())) {
   throw new ValidationException(String.format("Duplicate column name [%s]", field));
  }
  fieldHashSet.add(field.toLowerCase());
 }
}
origin: org.apache.drill/drill-shaded-guava

private Undirected(BaseGraph<N> graph) {
 super(graph);
 this.visitedNodes = Sets.newHashSetWithExpectedSize(graph.nodes().size());
}
origin: org.apache.drill/drill-shaded-guava

 @Override
 public boolean retainAll(Collection<?> c) {
  try {
   return super.retainAll(checkNotNull(c));
  } catch (UnsupportedOperationException e) {
   // if the iterators don't support remove
   Set<Object> keys = Sets.newHashSetWithExpectedSize(c.size());
   for (Object o : c) {
    if (contains(o)) {
     Entry<?, ?> entry = (Entry<?, ?>) o;
     keys.add(entry.getKey());
    }
   }
   return map().keySet().retainAll(keys);
  }
 }
}
org.apache.drill.shaded.guava.com.google.common.collectSetsnewHashSetWithExpectedSize

Javadoc

Returns a new hash set using the smallest initial table size that can hold expectedSizeelements without resizing. Note that this is not what HashSet#HashSet(int) does, but it is what most users want and expect it to do.

This behavior can't be broadly guaranteed, but has been tested with OpenJDK 1.7 and 1.8.

Popular methods of Sets

  • newHashSet
    Creates a mutable HashSet instance initially containing the given elements.Note: if elements are non
  • newLinkedHashSet
    Creates a mutable LinkedHashSet instance containing the given elements in order. Note: if mutability
  • newTreeSet
    Creates a mutable, empty TreeSet instance with the given comparator.Note: if mutability is not requi
  • union
    Returns an unmodifiable view of the union of two sets. The returned set contains all elements that a
  • filter
    Returns the elements of a SortedSet, unfiltered, that satisfy a predicate. The returned set is a liv
  • intersection
    Returns an unmodifiable view of the intersection of two sets. The returned set contains all elements
  • newIdentityHashSet
    Creates an empty Set that uses identity to determine equality. It compares object references, instea
  • cartesianProduct
    Returns every possible list that can be formed by choosing one element from each of the given sets i
  • difference
    Returns an unmodifiable view of the difference of two sets. The returned set contains all elements t
  • equalsImpl
    An implementation for Set#equals(Object).
  • hashCodeImpl
    An implementation for Set#hashCode().
  • immutableEnumSet
    Returns an immutable set instance containing the given enum elements. Internally, the returned set w
  • hashCodeImpl,
  • immutableEnumSet,
  • makeComplementByHand,
  • newConcurrentHashSet,
  • newLinkedHashSetWithExpectedSize,
  • removeAllImpl,
  • unmodifiableNavigableSet

Popular in Java

  • Making http post requests using okhttp
  • findViewById (Activity)
  • setContentView (Activity)
  • addToBackStack (FragmentTransaction)
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now