java.util.Vector.retainAll()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(106)

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

Vector.retainAll介绍

[英]Removes all objects from this vector that are not contained in the specified collection.
[中]

代码示例

代码示例来源:origin: org.scribble.bundles/org.scribble.protocol

/**
 * Retains only the elements in this list that are contained in the
 * specified collection (optional operation).  In other words, removes
 * from this list all the elements that are not contained in the specified
 * collection.
 *
 * @param c collection that defines which elements this set will retain.
 * 
 * @return <tt>true</tt> if this list changed as a result of the call.
 * @see #remove(Object)
 * @see #contains(Object)
 */
public boolean retainAll(Collection<?> c) {
  return (super.retainAll(c));
}

代码示例来源:origin: org.scribble/scribble-model

/**
 * Retains only the elements in this list that are contained in the
 * specified collection (optional operation).  In other words, removes
 * from this list all the elements that are not contained in the specified
 * collection.
 *
 * @param c collection that defines which elements this set will retain.
 * 
 * @return <tt>true</tt> if this list changed as a result of the call.
 * @see #remove(Object)
 * @see #contains(Object)
 */
public boolean retainAll(Collection<?> c) {
  return (super.retainAll(c));
}

代码示例来源:origin: org.openrdf.alibaba/alibaba-composition-object

public OrderedProperties(InputStream inStream) throws IOException {
  super.load(inStream);
  propertyNames.retainAll(super.keySet());
  loaded = true;
}

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

public OrderedProperties(InputStream inStream) throws IOException {
  super.load(inStream);
  propertyNames.retainAll(super.keySet());
  loaded = true;
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * First wait until complete.
 */
public synchronized boolean retainAll(Collection collection) {
  waitUntilComplete();
  return super.retainAll(collection);
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * First wait until complete.
 */
public synchronized boolean retainAll(Collection collection) {
  waitUntilComplete();
  return super.retainAll(collection);
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * First wait until complete.
 */
public synchronized boolean retainAll(Collection collection) {
  waitUntilComplete();
  return super.retainAll(collection);
}

代码示例来源:origin: toplink.essentials/toplink-essentials

/**
 * First wait until complete.
 */
public synchronized boolean retainAll(Collection collection) {
  waitUntilComplete();
  return super.retainAll(collection);
}

代码示例来源:origin: com.bbossgroups.rpc/bboss-rpc

/** Removes all elements from suspected_mbrs that are <em>not</em> in the new membership */
  void adjustSuspectedMembers(List<Address> new_mbrship) {
    if(new_mbrship == null || new_mbrship.isEmpty()) return;
    synchronized(suspected_mbrs) {
      suspected_mbrs.retainAll(new_mbrship);
      if(suspected_mbrs.isEmpty())
        stopBroadcastTask();
    }
  }
}

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

/** Removes all elements from suspected_mbrs that are <em>not</em> in the new membership */
  void adjustSuspectedMembers(List new_mbrship) {
    if(new_mbrship == null || new_mbrship.isEmpty()) return;
    StringBuilder sb=new StringBuilder();
    synchronized(suspected_mbrs) {
      sb.append("suspected_mbrs: ").append(suspected_mbrs);
      suspected_mbrs.retainAll(new_mbrship);
      if(suspected_mbrs.isEmpty())
        stopBroadcastTask();
      sb.append(", after adjustment: ").append(suspected_mbrs);
      log.debug(sb.toString());
    }
  }
}

代码示例来源:origin: io.snappydata/gemfire-jgroups

/** Removes all elements from suspected_mbrs that are <em>not</em> in the new membership */
    void adjustSuspectedMembers(List new_mbrship) {
      if(new_mbrship == null || new_mbrship.size() == 0) return;
      StringBuffer sb=new StringBuffer();
      synchronized(suspected_mbrs) {
        if (log.isDebugEnabled()) sb.append("suspected_mbrs: ").append(suspected_mbrs);
        suspected_mbrs.retainAll(new_mbrship);
//                if(suspected_mbrs.size() == 0)
//                    stopBroadcastTask();
        if (log.isDebugEnabled()) sb.append(", after adjustment: ").append(suspected_mbrs);
        log.debug(sb.toString());
      }
    }
  }

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

/**
 * Create a copy of view which contains only members which are present in hosts. Call viewAccepted() on the MuxChannel
 * which corresponds with service. If no members are removed or added from/to view, this is a no-op.
 * @param hosts List<Address>
 * @return the servicd view (a modified copy of the real view), or null if the view was not modified
 */
private View generateServiceView(List hosts) {
  Vector<Address> members=new Vector<Address>(view.getMembers());
  members.retainAll(hosts);
  return new View(view.getVid(), members);
}

代码示例来源:origin: net.rforge/REngine

public boolean retainAll(Collection c) {
if (names==null) return super.retainAll(c);
boolean rm[] = new boolean[size()];
boolean changed=false;
int i = 0;
while (i<rm.length) {
  changed|=rm[i]=!c.contains(get(i));
  i++;
}
while (i>0) {
  i--;
  if (rm[i]) remove(i);
}
return changed;
}

代码示例来源:origin: org.rosuda.REngine/REngine

public boolean retainAll(Collection c) {
if (names==null) return super.retainAll(c);
boolean rm[] = new boolean[size()];
boolean changed=false;
int i = 0;
while (i<rm.length) {
  changed|=rm[i]=!c.contains(get(i));
  i++;
}
while (i>0) {
  i--;
  if (rm[i]) remove(i);
}
return changed;
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * @see java.util.Vector#retainAll(java.util.Collection)
 */
public boolean retainAll(Collection c) {
  // Must trigger remove events if tracked or uow.
  if (hasBeenRegistered() || hasTrackedPropertyChangeListener()) {
    Iterator objects = getDelegate().iterator();
    while (objects.hasNext()) {
      Object object = objects.next();
      if (!c.contains(object)) {
        objects.remove();
        raiseRemoveChangeEvent(object, null);
      }
    }
    return true;
  }
  return getDelegate().retainAll(c);
}

代码示例来源:origin: org.apache.openejb.patch/openjpa

@Override
public synchronized boolean retainAll(Collection paramCollection) {
  if (_directAccess) {
    return super.retainAll(paramCollection);
  }
  if (isDelayLoad()) {
    load();
  }
  return ProxyCollections.retainAll(this, paramCollection);
}

代码示例来源:origin: org.apache.openejb.patch/openjpa-kernel

@Override
public synchronized boolean retainAll(Collection paramCollection) {
  if (_directAccess) {
    return super.retainAll(paramCollection);
  }
  if (isDelayLoad()) {
    load();
  }
  return ProxyCollections.retainAll(this, paramCollection);
}

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

@Override
public synchronized boolean retainAll(Collection paramCollection) {
  if (_directAccess) {
    return super.retainAll(paramCollection);
  }
  if (isDelayLoad()) {
    load();
  }
  return ProxyCollections.retainAll(this, paramCollection);
}

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

@Override
public synchronized boolean retainAll(Collection paramCollection) {
  if (_directAccess) {
    return super.retainAll(paramCollection);
  }
  if (isDelayLoad()) {
    load();
  }
  return ProxyCollections.retainAll(this, paramCollection);
}

代码示例来源:origin: octo-online/reactive-audit

@Test(expected = ReactiveAuditException.class)
public void retainAll()
{
  ReactiveAudit.off.commit();
  Vector vector=new Vector();
  TestTools.strict.commit();
  vector.retainAll(null);
}
@Test(expected = ReactiveAuditException.class)

相关文章

微信公众号

最新文章

更多