org.apache.commons.collections.Bag.isEmpty()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(10.7k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中org.apache.commons.collections.Bag.isEmpty()方法的一些代码示例,展示了Bag.isEmpty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bag.isEmpty()方法的具体详情如下:
包路径:org.apache.commons.collections.Bag
类名称:Bag
方法名:isEmpty

Bag.isEmpty介绍

暂无

代码示例

代码示例来源:origin: commons-collections/commons-collections

/**
 * Remove any members of the bag that are not in the given
 * bag, respecting cardinality.
 * @see #retainAll(Collection)
 * 
 * @param other  the bag to retain
 * @return <code>true</code> if this call changed the collection
 */
boolean retainAll(Bag other) {
  boolean result = false;
  Bag excess = new HashBag();
  Iterator i = uniqueSet().iterator();
  while (i.hasNext()) {
    Object current = i.next();
    int myCount = getCount(current);
    int otherCount = other.getCount(current);
    if (1 <= otherCount && otherCount <= myCount) {
      excess.add(current, myCount - otherCount);
    } else {
      excess.add(current, myCount);
    }
  }
  if (!excess.isEmpty()) {
    result = removeAll(excess);
  }
  return result;
}

代码示例来源:origin: commons-collections/commons-collections

/**
 * Remove any members of the bag that are not in the given
 * bag, respecting cardinality.
 * @see #retainAll(Collection)
 * 
 * @param other  the bag to retain
 * @return <code>true</code> if this call changed the collection
 */
public boolean retainAll(Bag other) {
  boolean result = false;
  Bag excess = new HashBag();
  Iterator i = uniqueSet().iterator();
  while (i.hasNext()) {
    Object current = i.next();
    int myCount = getCount(current);
    int otherCount = other.getCount(current);
    if (1 <= otherCount && otherCount <= myCount) {
      excess.add(current, myCount - otherCount);
    } else {
      excess.add(current, myCount);
    }
  }
  if (!excess.isEmpty()) {
    result = removeAll(excess);
  }
  return result;
}

代码示例来源:origin: wildfly/wildfly

/**
 * Remove any members of the bag that are not in the given
 * bag, respecting cardinality.
 * @see #retainAll(Collection)
 * 
 * @param other  the bag to retain
 * @return <code>true</code> if this call changed the collection
 */
public boolean retainAll(Bag other) {
  boolean result = false;
  Bag excess = new HashBag();
  Iterator i = uniqueSet().iterator();
  while (i.hasNext()) {
    Object current = i.next();
    int myCount = getCount(current);
    int otherCount = other.getCount(current);
    if (1 <= otherCount && otherCount <= myCount) {
      excess.add(current, myCount - otherCount);
    } else {
      excess.add(current, myCount);
    }
  }
  if (!excess.isEmpty()) {
    result = removeAll(excess);
  }
  return result;
}

代码示例来源:origin: wildfly/wildfly

/**
 * Remove any members of the bag that are not in the given
 * bag, respecting cardinality.
 * @see #retainAll(Collection)
 * 
 * @param other  the bag to retain
 * @return <code>true</code> if this call changed the collection
 */
boolean retainAll(Bag other) {
  boolean result = false;
  Bag excess = new HashBag();
  Iterator i = uniqueSet().iterator();
  while (i.hasNext()) {
    Object current = i.next();
    int myCount = getCount(current);
    int otherCount = other.getCount(current);
    if (1 <= otherCount && otherCount <= myCount) {
      excess.add(current, myCount - otherCount);
    } else {
      excess.add(current, myCount);
    }
  }
  if (!excess.isEmpty()) {
    result = removeAll(excess);
  }
  return result;
}

代码示例来源:origin: dstl/baleen

/** @return true if this bag is empty */
public boolean isEmpty() {
 return words.isEmpty();
}

代码示例来源:origin: uk.gov.dstl.baleen/baleen-entity-linking

/** @return true if this bag is empty */
public boolean isEmpty() {
 return words.isEmpty();
}

代码示例来源:origin: hopshadoop/hopsworks

@Override
 public void run() {
  deleteMaterialFromLocalFs(key, materializationDirectory);
  Map<String, Runnable> materialRemovers = fileRemovers.get(key);
  if (materialRemovers != null) {
   materialRemovers.remove(materializationDirectory);
   if (materialRemovers.isEmpty()) {
    fileRemovers.remove(key);
   }

   // No more references to that crypto material, wipe out password
   try {
    localWriteLock.lock();
    Bag materialBag = materializedCerts.get(key);
    if (materialBag.isEmpty()) {
     materializedCerts.remove(key);
     CryptoMaterial material = materialCache.remove(key);
     if (material != null) {
      material.wipePassword();
     }
    }
   } finally {
    localWriteLock.unlock();
   }
   
   LOG.log(Level.FINEST, "Deleted crypto material for <" + key.getExtendedUsername() + "> from directory "
     + materializationDirectory);
  }
 }
}

代码示例来源:origin: hopshadoop/hopsworks

if (materialBag != null) {
 materialBag.remove(materializationDirectory);
 if (materialBag.isEmpty()) {
  materializedCerts.remove(key);
  CryptoMaterial material = materialCache.remove(key);

代码示例来源:origin: org.jboss.eap/wildfly-client-all

/**
 * Remove any members of the bag that are not in the given
 * bag, respecting cardinality.
 * @see #retainAll(Collection)
 * 
 * @param other  the bag to retain
 * @return <code>true</code> if this call changed the collection
 */
boolean retainAll(Bag other) {
  boolean result = false;
  Bag excess = new HashBag();
  Iterator i = uniqueSet().iterator();
  while (i.hasNext()) {
    Object current = i.next();
    int myCount = getCount(current);
    int otherCount = other.getCount(current);
    if (1 <= otherCount && otherCount <= myCount) {
      excess.add(current, myCount - otherCount);
    } else {
      excess.add(current, myCount);
    }
  }
  if (!excess.isEmpty()) {
    result = removeAll(excess);
  }
  return result;
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

/**
 * Remove any members of the bag that are not in the given
 * bag, respecting cardinality.
 * @see #retainAll(Collection)
 * 
 * @param other  the bag to retain
 * @return <code>true</code> if this call changed the collection
 */
public boolean retainAll(Bag other) {
  boolean result = false;
  Bag excess = new HashBag();
  Iterator i = uniqueSet().iterator();
  while (i.hasNext()) {
    Object current = i.next();
    int myCount = getCount(current);
    int otherCount = other.getCount(current);
    if (1 <= otherCount && otherCount <= myCount) {
      excess.add(current, myCount - otherCount);
    } else {
      excess.add(current, myCount);
    }
  }
  if (!excess.isEmpty()) {
    result = removeAll(excess);
  }
  return result;
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

/**
 * Remove any members of the bag that are not in the given
 * bag, respecting cardinality.
 * @see #retainAll(Collection)
 * 
 * @param other  the bag to retain
 * @return <code>true</code> if this call changed the collection
 */
boolean retainAll(Bag other) {
  boolean result = false;
  Bag excess = new HashBag();
  Iterator i = uniqueSet().iterator();
  while (i.hasNext()) {
    Object current = i.next();
    int myCount = getCount(current);
    int otherCount = other.getCount(current);
    if (1 <= otherCount && otherCount <= myCount) {
      excess.add(current, myCount - otherCount);
    } else {
      excess.add(current, myCount);
    }
  }
  if (!excess.isEmpty()) {
    result = removeAll(excess);
  }
  return result;
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-all

/**
 * Remove any members of the bag that are not in the given
 * bag, respecting cardinality.
 * @see #retainAll(Collection)
 * 
 * @param other  the bag to retain
 * @return <code>true</code> if this call changed the collection
 */
public boolean retainAll(Bag other) {
  boolean result = false;
  Bag excess = new HashBag();
  Iterator i = uniqueSet().iterator();
  while (i.hasNext()) {
    Object current = i.next();
    int myCount = getCount(current);
    int otherCount = other.getCount(current);
    if (1 <= otherCount && otherCount <= myCount) {
      excess.add(current, myCount - otherCount);
    } else {
      excess.add(current, myCount);
    }
  }
  if (!excess.isEmpty()) {
    result = removeAll(excess);
  }
  return result;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-collections

/**
 * Remove any members of the bag that are not in the given
 * bag, respecting cardinality.
 * @see #retainAll(Collection)
 * 
 * @param other  the bag to retain
 * @return <code>true</code> if this call changed the collection
 */
boolean retainAll(Bag other) {
  boolean result = false;
  Bag excess = new HashBag();
  Iterator i = uniqueSet().iterator();
  while (i.hasNext()) {
    Object current = i.next();
    int myCount = getCount(current);
    int otherCount = other.getCount(current);
    if (1 <= otherCount && otherCount <= myCount) {
      excess.add(current, myCount - otherCount);
    } else {
      excess.add(current, myCount);
    }
  }
  if (!excess.isEmpty()) {
    result = removeAll(excess);
  }
  return result;
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-all

/**
 * Remove any members of the bag that are not in the given
 * bag, respecting cardinality.
 * @see #retainAll(Collection)
 * 
 * @param other  the bag to retain
 * @return <code>true</code> if this call changed the collection
 */
boolean retainAll(Bag other) {
  boolean result = false;
  Bag excess = new HashBag();
  Iterator i = uniqueSet().iterator();
  while (i.hasNext()) {
    Object current = i.next();
    int myCount = getCount(current);
    int otherCount = other.getCount(current);
    if (1 <= otherCount && otherCount <= myCount) {
      excess.add(current, myCount - otherCount);
    } else {
      excess.add(current, myCount);
    }
  }
  if (!excess.isEmpty()) {
    result = removeAll(excess);
  }
  return result;
}

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

/**
 * Remove any members of the bag that are not in the given
 * bag, respecting cardinality.
 * @see #retainAll(Collection)
 * 
 * @param other  the bag to retain
 * @return <code>true</code> if this call changed the collection
 */
public boolean retainAll(Bag other) {
  boolean result = false;
  Bag excess = new HashBag();
  Iterator i = uniqueSet().iterator();
  while (i.hasNext()) {
    Object current = i.next();
    int myCount = getCount(current);
    int otherCount = other.getCount(current);
    if (1 <= otherCount && otherCount <= myCount) {
      excess.add(current, myCount - otherCount);
    } else {
      excess.add(current, myCount);
    }
  }
  if (!excess.isEmpty()) {
    result = removeAll(excess);
  }
  return result;
}

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

/**
 * Remove any members of the bag that are not in the given
 * bag, respecting cardinality.
 * @see #retainAll(Collection)
 * 
 * @param other  the bag to retain
 * @return <code>true</code> if this call changed the collection
 */
boolean retainAll(Bag other) {
  boolean result = false;
  Bag excess = new HashBag();
  Iterator i = uniqueSet().iterator();
  while (i.hasNext()) {
    Object current = i.next();
    int myCount = getCount(current);
    int otherCount = other.getCount(current);
    if (1 <= otherCount && otherCount <= myCount) {
      excess.add(current, myCount - otherCount);
    } else {
      excess.add(current, myCount);
    }
  }
  if (!excess.isEmpty()) {
    result = removeAll(excess);
  }
  return result;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-collections

/**
 * Remove any members of the bag that are not in the given
 * bag, respecting cardinality.
 * @see #retainAll(Collection)
 * 
 * @param other  the bag to retain
 * @return <code>true</code> if this call changed the collection
 */
public boolean retainAll(Bag other) {
  boolean result = false;
  Bag excess = new HashBag();
  Iterator i = uniqueSet().iterator();
  while (i.hasNext()) {
    Object current = i.next();
    int myCount = getCount(current);
    int otherCount = other.getCount(current);
    if (1 <= otherCount && otherCount <= myCount) {
      excess.add(current, myCount - otherCount);
    } else {
      excess.add(current, myCount);
    }
  }
  if (!excess.isEmpty()) {
    result = removeAll(excess);
  }
  return result;
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

/**
 * Remove any members of the bag that are not in the given
 * bag, respecting cardinality.
 * @see #retainAll(Collection)
 * 
 * @param other  the bag to retain
 * @return <code>true</code> if this call changed the collection
 */
public boolean retainAll(Bag other) {
  boolean result = false;
  Bag excess = new HashBag();
  Iterator i = uniqueSet().iterator();
  while (i.hasNext()) {
    Object current = i.next();
    int myCount = getCount(current);
    int otherCount = other.getCount(current);
    if (1 <= otherCount && otherCount <= myCount) {
      excess.add(current, myCount - otherCount);
    } else {
      excess.add(current, myCount);
    }
  }
  if (!excess.isEmpty()) {
    result = removeAll(excess);
  }
  return result;
}

相关文章