Codota Logo
Sets.newHashSetWithExpectedSize
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Connection c =
  • Codota IconDataSource dataSource;dataSource.getConnection()
  • Codota IconString url;DriverManager.getConnection(url)
  • Codota IconIdentityDatabaseUtil.getDBConnection()
  • Smart code suggestions by Codota
}
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

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (Timer)
  • getContentResolver (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now