Tabnine Logo
HashSet.size
Code IndexAdd Tabnine to your IDE (free)

How to use
size
method
in
java.util.HashSet

Best Java code snippets using java.util.HashSet.size (Showing top 20 results out of 13,284)

Refine searchRefine arrow

  • HashSet.add
  • HashSet.<init>
  • Iterator.hasNext
  • Iterator.next
  • HashSet.toArray
  • HashSet.iterator
  • HashSet.contains
origin: airbnb/lottie-android

public ArrayList<String> getWarnings() {
 return new ArrayList<>(Arrays.asList(warnings.toArray(new String[warnings.size()])));
}
origin: apache/storm

public StringValidator(Map<String, Object> params) {
  this.acceptedValues =
    new HashSet<String>(Arrays.asList((String[]) params.get(ConfigValidationAnnotations.ValidatorParams.ACCEPTED_VALUES)));
  if (this.acceptedValues.isEmpty() || (this.acceptedValues.size() == 1 && this.acceptedValues.contains(""))) {
    this.acceptedValues = null;
  }
}
origin: apache/storm

@Override
public Collection<Node> takeNodes(int nodesNeeded) {
  HashSet<Node> ret = new HashSet<>();
  Iterator<Node> it = _nodes.iterator();
  while (it.hasNext() && nodesNeeded > ret.size()) {
    Node n = it.next();
    ret.add(n);
    _totalSlots -= n.totalSlotsFree();
    it.remove();
  }
  return ret;
}
origin: neo4j/neo4j

  private IndexLimitation[] limitationsUnion( Iterable<IndexCapability> capabilities )
  {
    HashSet<IndexLimitation> union = new HashSet<>();
    for ( IndexCapability capability : capabilities )
    {
      union.addAll( Arrays.asList( capability.limitations() ) );
    }
    return union.toArray( new IndexLimitation[union.size()] );
  }
}
origin: oblac/jodd

/**
 * Counts profile properties. Note: this method is not
 * that easy on execution.
 */
public int countProfileProperties() {
  final HashSet<String> profileKeys = new HashSet<>();
  for (final Map<String, PropsEntry> map : profileProperties.values()) {
    for (final String key : map.keySet()) {
      if (!baseProperties.containsKey(key)) {
        profileKeys.add(key);
      }
    }
  }
  return profileKeys.size();
}
origin: Sable/soot

statement: for (Iterator sIt = body.getUnits().iterator(); sIt.hasNext();) {
 final Stmt s = (Stmt) sIt.next();
 HashSet read = new HashSet();
 HashSet write = new HashSet();
 Iterator<MethodOrMethodContext> it = tt.iterator(s);
 while (it.hasNext()) {
  SootMethod target = (SootMethod) it.next();
  ensureProcessed(target);
  if (target.isNative()) {
  if (read.size() + write.size() > threshold) {
   continue statement;
origin: FudanNLP/fnlp

public String getFeaturesFromNodes(WordTree node, String word,String tag,int depth){
  if(node.depth>depth)
    return " ";
  String res = "";
  String newfeature =tag;
  newfeature = newfeature+node.tag+".";
  if(node.wordSet.size()>0)
  {
    if(node.wordSet.contains(word))
      newfeature = newfeature +"1 ";
    else
      newfeature = newfeature +"0 ";
    res = res + newfeature;
  }
  Iterator<WordTree> it = node.childs.iterator();
  while(it.hasNext()){
    WordTree subnode = it.next();
    if(subnode==null)
      continue;
    res = res + getFeaturesFromNodes(subnode,word,newfeature,depth);
  }
  return res;
}
origin: FudanNLP/fnlp

public void countConflict() {
  int conflict = 0;
  Iterator it = map.entrySet().iterator();
  while (it.hasNext()) {
    Map.Entry entry = (Map.Entry)it.next();
    HashSet<String> hashset = (HashSet<String>)entry.getValue();
    conflict += (hashset.size() - 1);
    //            if(hashset.size() >1)
    //              System.out.println(hashset);
  }
  System.out.println(conflict + " / " + count + " = " + (double)conflict/(double)count);
  map.clear();
  map =null;
}
origin: gocd/gocd

public void validate(ValidationContext validationContext) {
  if (new HashSet<>(roleNames()).size() != roleNames().size()) {
    this.configErrors.add("name", "Role names should be unique. Duplicate names found.");
  }
}
origin: hibernate/hibernate-orm

public String[] collectQuerySpaces() {
  final HashSet<String> spaces = new HashSet<String>();
  collectQuerySpaces( spaces );
  return spaces.toArray( new String[ spaces.size() ] );
}
origin: apache/geode

public void unregisterSC(ServerConnection sc) {
 // removed syncLock synchronization to fix bug 37104
 synchronized (this.allSCsLock) {
  this.allSCs.remove(sc);
  Iterator it = this.allSCs.iterator();
  ServerConnection again[] = new ServerConnection[this.allSCs.size()];
  for (int i = 0; i < again.length; i++) {
   again[i] = (ServerConnection) it.next();
  }
  this.allSCList = again;
 }
 if (!isRunning()) {
  return;
 }
 // just need to wake the selector up so it will notice our socket was closed
 wakeupSelector();
}
origin: loklak/loklak_server

@Override
public boolean addQuery(String query, double score) {
  if (this.queryLimit > 0 && this.queries.size() > this.queryLimit)
    return false;
  if (queries.contains(query))
    return false;
  this.queries.add(query);
  return true;
}
origin: naman14/Timber

  @Override
  public void failure(RetrofitError error) {
    synchronized (sLock) {
      isUploading = false;
      //Max 500 scrobbles in Cache
      if (newquery != null && queries.size() <= 500)
        queries.add(newquery.toString());
      if (cachedirty)
        save();
    }
  }
});
origin: FudanNLP/fnlp

private ArrayList<String> findOOV(LinkedList<Entity> cList) {
  ArrayList<String> oovs  = new ArrayList<String>();
  if(dict!=null&&dict.size()>0){
    for(Entity e: cList){
      String s = e.getEntityStr();
      if(!dict.contains(s))
        oovs.add(s);
    }
  }
  //		if(oovs.size()>11)
  //			System.out.println(oovs);
  return oovs;
}
origin: spring-projects/spring-data-rest

@Override
protected ProducesRequestCondition customize(ProducesRequestCondition condition) {
  if (!condition.isEmpty()) {
    return condition;
  }
  HashSet<String> mediaTypes = new LinkedHashSet<String>();
  mediaTypes.add(configuration.getDefaultMediaType().toString());
  mediaTypes.add(MediaType.APPLICATION_JSON_VALUE);
  return new ProducesRequestCondition(mediaTypes.toArray(new String[mediaTypes.size()]));
}
origin: jenkinsci/jenkins

@Override
protected int act(List<Run<?, ?>> builds) throws IOException {
  job.checkPermission(Run.DELETE);
  final HashSet<Integer> hsBuilds = new HashSet<>();
  for (Run<?, ?> build : builds) {
    if (!hsBuilds.contains(build.number)) {
      build.delete();
      hsBuilds.add(build.number);
    }
  }
  stdout.println("Deleted "+hsBuilds.size()+" builds");
  return 0;
}
origin: quartz-scheduler/quartz

public String[] getPropertyGroups(String prefix) {
  Enumeration<?> keys = props.propertyNames();
  HashSet<String> groups = new HashSet<String>(10);
  if (!prefix.endsWith(".")) {
    prefix += ".";
  }
  while (keys.hasMoreElements()) {
    String key = (String) keys.nextElement();
    if (key.startsWith(prefix)) {
      String groupName = key.substring(prefix.length(), key.indexOf(
          '.', prefix.length()));
      groups.add(groupName);
    }
  }
  return (String[]) groups.toArray(new String[groups.size()]);
}
origin: apache/storm

@Override
public Collection<Node> takeNodes(int nodesNeeded) {
  HashSet<Node> ret = new HashSet<>();
  LinkedList<Node> sortedNodes = new LinkedList<>(_nodes);
  Collections.sort(sortedNodes, Node.FREE_NODE_COMPARATOR_DEC);
  for (Node n : sortedNodes) {
    if (nodesNeeded <= ret.size()) {
      break;
    }
    if (n.isAlive()) {
      n.freeAllSlots(_cluster);
      _nodes.remove(n);
      ret.add(n);
    }
  }
  return ret;
}
origin: spotbugs/spotbugs

public void execute() throws IOException {
  for (BugInstance bug : origCollection.getCollection()) {
    for (Iterator<BugAnnotation> i = bug.annotationIterator(); i.hasNext();) {
      copySourceForAnnotation(i.next());
    }
  }
  if (zOut != null) {
    zOut.close();
  }
  System.out.printf("All done. %d files not found, %d files copied%n", couldNotFind.size(), copyCount);
}
origin: gocd/gocd

private void validateMaterialUniqueness() {
  if (new HashSet<>(allMaterialFingerPrints()).size() != allMaterialFingerPrints()
      .size()) {
    this.errors().add("material", "You have defined multiple configuration repositories with the same repository.");
  }
}
java.utilHashSetsize

Javadoc

Returns the number of elements in this HashSet.

Popular methods of HashSet

  • <init>
  • add
    Adds the specified element to this set if it is not already present. More formally, adds the specifi
  • contains
    Returns true if this set contains the specified element. More formally, returns true if and only if
  • addAll
  • remove
    Removes the specified element from this set if it is present. More formally, removes an element e su
  • iterator
    Returns an iterator over the elements in this set. The elements are returned in no particular order.
  • isEmpty
    Returns true if this set contains no elements.
  • clear
    Removes all of the elements from this set. The set will be empty after this call returns.
  • toArray
  • removeAll
  • equals
  • clone
    Returns a shallow copy of this HashSet instance: the elements themselves are not cloned.
  • equals,
  • clone,
  • retainAll,
  • stream,
  • containsAll,
  • forEach,
  • hashCode,
  • toString,
  • removeIf

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setRequestProperty (URLConnection)
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Table (org.hibernate.mapping)
    A relational table
  • Top Vim plugins
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