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

How to use
intersection
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.intersection (Showing top 2 results out of 315)

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

@Override
Set<E> createElementSet() {
 return Sets.intersection(multiset1.elementSet(), multiset2.elementSet());
}
origin: org.apache.drill.exec/drill-java-exec

/**
 * Checks if the proxy user is authorized to impersonate the target user based on the policies.
 *
 * @param proxyName  proxy user name
 * @param targetName target user name
 * @param policies   impersonation policies
 * @return true iff proxy user is authorized to impersonate the target user
 */
private static boolean hasImpersonationPrivileges(final String proxyName, final String targetName,
                         final List<ImpersonationPolicy> policies) {
 final UserGroupInformation proxyUgi = ImpersonationUtil.createProxyUgi(proxyName);
 final Set<String> proxyGroups = Sets.newHashSet(proxyUgi.getGroupNames());
 final UserGroupInformation targetUgi = ImpersonationUtil.createProxyUgi(targetName);
 final Set<String> targetGroups = Sets.newHashSet(targetUgi.getGroupNames());
 for (final ImpersonationPolicy definition : policies) {
  // check if proxy user qualifies within this policy
  if (definition.proxy_principals.users.contains(proxyName) ||
    !Sets.intersection(definition.proxy_principals.groups, proxyGroups).isEmpty()) {
   // check if target qualifies within this policy
   if (definition.target_principals.users.contains(targetName) ||
     definition.target_principals.users.contains(STAR) ||
     !Sets.intersection(definition.target_principals.groups, targetGroups).isEmpty() ||
     definition.target_principals.groups.contains(STAR)) {
    return true;
   }
  }
 }
 return false;
}
org.apache.drill.shaded.guava.com.google.common.collectSetsintersection

Javadoc

Returns an unmodifiable view of the intersection of two sets. The returned set contains all elements that are contained by both backing sets. The iteration order of the returned set matches that of set1.

Results are undefined if set1 and set2 are sets based on different equivalence relations (as HashSet, TreeSet, and the keySet of an IdentityHashMap all are).

Note: The returned view performs slightly better when set1 is the smaller of the two sets. If you have reason to believe one of your sets will generally be smaller than the other, pass it first. Unfortunately, since this method sets the generic type of the returned set based on the type of the first set passed, this could in rare cases force you to make a cast, for example:

    
Set aFewBadObjects = ...

This is unfortunate, but should come up only very rarely.

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
  • newHashSetWithExpectedSize
    Returns a new hash set using the smallest initial table size that can hold expectedSizeelements with
  • 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

  • Reactive rest calls using spring rest template
  • onCreateOptionsMenu (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • addToBackStack (FragmentTransaction)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • JFrame (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Github Copilot alternatives
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