- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {Connection c =
DataSource dataSource;dataSource.getConnection()
String url;DriverManager.getConnection(url)
IdentityDatabaseUtil.getDBConnection()
- Smart code suggestions by Codota
}
/** * {@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); }
@Override public Set<V> get() { return Sets.newHashSetWithExpectedSize(expectedValuesPerKey); } }
/** * 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; }
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()); } }
private Undirected(BaseGraph<N> graph) { super(graph); this.visitedNodes = Sets.newHashSetWithExpectedSize(graph.nodes().size()); }
@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); } } }