本文整理了Java中java.util.Vector.clone()
方法的一些代码示例,展示了Vector.clone()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vector.clone()
方法的具体详情如下:
包路径:java.util.Vector
类名称:Vector
方法名:clone
[英]Returns a new vector with the same elements, size, capacity and capacity increment as this vector.
[中]返回一个与此向量具有相同元素、大小、容量和容量增量的新向量。
代码示例来源:origin: io.snappydata/gemfire-jgroups
/**
* @return a copy of stable messages, or null (if non available). Removes
* all stable messages afterwards
*/
public Vector getStableMessages() {
Vector retval;
synchronized(stable_msgs) {
retval = (stable_msgs.size() > 0)? (Vector)stable_msgs.clone():null;
if (stable_msgs.size() > 0) stable_msgs.clear();
}
return(retval);
}
代码示例来源:origin: com.bbossgroups.rpc/bboss-rpc
Address getHeartbeatDest() {
Address retval=null;
int r, size;
Vector<Address> members_copy;
if(members == null || members.size() < 2 || local_addr == null)
return null;
members_copy=(Vector)members.clone();
members_copy.removeElement(local_addr); // don't select myself as heartbeat destination
size=members_copy.size();
r=((int)(Math.random() * (size + 1))) % size;
retval=members_copy.elementAt(r);
return retval;
}
代码示例来源:origin: io.snappydata/gemfire-jgroups
Address getHeartbeatDest() {
Address retval=null;
int r, size;
Vector members_copy;
if(members == null || members.size() < 2 || local_addr == null)
return null;
members_copy=(Vector) members.clone();
members_copy.removeElement(local_addr); // don't select myself as heartbeat destination
size=members_copy.size();
r=((int) (Math.random() * (size + 1))) % size;
retval=(Address) members_copy.elementAt(r);
return retval;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-debugger-jpda-projectsui
public void fireTreeChanged () {
Vector v = (Vector) listeners.clone ();
int i, k = v.size ();
for (i = 0; i < k; i++) {
((ModelListener) v.get (i)).modelChanged (null);
}
}
代码示例来源:origin: io.snappydata/gemfire-jgroups
Address getHeartbeatDest() {
Address retval=null;
int r, size;
Vector members_copy;
if(members == null || members.size() < 2 || local_addr == null)
return null;
members_copy=(Vector)members.clone();
members_copy.removeElement(local_addr); // don't select myself as heartbeat destination
size=members_copy.size();
r=((int)(Math.random() * (size + 1))) % size;
retval=(Address)members_copy.elementAt(r);
return retval;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-debugger-jpda-projectsui
public void fireTreeChanged () {
Vector v = (Vector) listeners.clone ();
int i, k = v.size ();
for (i = 0; i < k; i++) {
((ModelListener) v.get (i)).modelChanged (null);
}
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
Address getHeartbeatDest() {
Address retval=null;
int r, size;
Vector members_copy;
if(members == null || members.size() < 2 || local_addr == null)
return null;
members_copy=(Vector)members.clone();
members_copy.removeElement(local_addr); // don't select myself as heartbeat destination
size=members_copy.size();
r=((int)(Math.random() * (size + 1))) % size;
retval=(Address)members_copy.elementAt(r);
return retval;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-debugger-jpda-projects
public void fireTreeChanged () {
Vector v = (Vector) listeners.clone ();
int i, k = v.size ();
for (i = 0; i < k; i++) {
((ModelListener) v.get (i)).modelChanged (null);
}
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
@SuppressWarnings("unchecked")
private void notifyChartListeners(ChartEvent ce) {
Vector<ChartListener> l;
synchronized (this) {
l = (Vector<ChartListener>) m_listeners.clone();
}
if (l.size() > 0) {
for (int i = 0; i < l.size(); i++) {
l.elementAt(i).acceptDataPoint(ce);
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-debugger-jpda-projects
public void fireTreeChanged () {
Vector v = (Vector) listeners.clone ();
int i, k = v.size ();
for (i = 0; i < k; i++) {
((ModelListener) v.get (i)).modelChanged (null);
}
}
代码示例来源:origin: org.ow2.joram/joram-mom-core
public void closeAllConnections() {
Vector stopList = (Vector) connections.clone();
for (int i = 0; i < stopList.size(); i++) {
TcpConnection tc = (TcpConnection) stopList.elementAt(i);
tc.close();
}
}
代码示例来源:origin: org.apache.ant/ant-junit
/**
* @param test junit test
* @return array of FormatterElement
* @since Ant 1.3
*/
private FormatterElement[] mergeFormatters(final JUnitTest test) {
@SuppressWarnings("unchecked")
final Vector<FormatterElement> feVector = (Vector<FormatterElement>) formatters.clone();
test.addFormattersTo(feVector);
final FormatterElement[] feArray = new FormatterElement[feVector.size()];
feVector.copyInto(feArray);
return feArray;
}
代码示例来源:origin: org.glassfish.external/antlr
protected void refresh(Vector listeners) {
Vector v;
synchronized (listeners) {
v = (Vector)listeners.clone();
}
if (v != null)
for (int i = 0; i < v.size(); i++)
((ListenerBase)v.elementAt(i)).refresh();
}
public void refreshListeners() {
代码示例来源:origin: jatecs/jatecs
@SuppressWarnings("unchecked")
public IClassificationDB cloneDB(ICategoryDB categoriesDB, IDocumentDB documentsDB) {
TroveClassificationILDB classificationDB = new TroveClassificationILDB(documentsDB, categoriesDB);
classificationDB._name = new String(_name);
classificationDB._categoriesDocuments = new Vector<TIntArrayList>(_categoriesDocuments.size());
classificationDB._categoriesDocumentsPrimary = new Vector<Vector<Boolean>>(_categoriesDocumentsPrimary.size());
for (int i = 0; i < _categoriesDocuments.size(); ++i) {
classificationDB._categoriesDocuments.add((TIntArrayList) _categoriesDocuments.get(i).clone());
classificationDB._categoriesDocumentsPrimary.add((Vector<Boolean>) _categoriesDocumentsPrimary.get(i).clone());
}
return classificationDB;
}
代码示例来源:origin: org.objectweb.joram/joram-mom-core
public void closeAllConnections() {
Vector stopList = (Vector) connections.clone();
for (int i = 0; i < stopList.size(); i++) {
TcpConnection tc = (TcpConnection) stopList.elementAt(i);
tc.close();
}
}
代码示例来源:origin: jatecs/jatecs
@SuppressWarnings("unchecked")
public IClassificationDB cloneDB(ICategoryDB categoriesDB, IDocumentDB documentsDB) {
TroveClassificationDB classificationDB = new TroveClassificationDB(documentsDB,categoriesDB);
classificationDB._name = new String(_name);
classificationDB._documentsCategories = new Vector<TShortArrayList>(_documentsCategories.size());
classificationDB._documentsCatsPrimary = new Vector<Vector<Boolean>>(_documentsCategories.size());
for(int i = 0;i<_documentsCategories.size();++i)
{
classificationDB._documentsCategories.add((TShortArrayList) _documentsCategories.get(i).clone());
classificationDB._documentsCatsPrimary.add((Vector<Boolean>) _documentsCatsPrimary.get(i).clone());
}
return classificationDB;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
@SuppressWarnings("unchecked")
private void notifyTestListeners(TestSetEvent ce) {
Vector<TestSetListener> l;
synchronized (this) {
l = (Vector<TestSetListener>) m_testListeners.clone();
}
if (l.size() > 0) {
for (int i = 0; i < l.size(); i++) {
l.elementAt(i).acceptTestSet(ce);
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-debugger-jpda-projects
private void fireSelectedNodes(Object[] nodes) {
ModelEvent event = new ModelEvent.SelectionChanged(this, nodes);
Vector v = (Vector) listeners.clone ();
int i, k = v.size ();
for (i = 0; i < k; i++) {
((ModelListener) v.get (i)).modelChanged (event);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-antlr
protected void refresh(Vector listeners) {
Vector v;
synchronized (listeners) {
v = (Vector)listeners.clone();
}
if (v != null)
for (int i = 0; i < v.size(); i++)
((ListenerBase)v.elementAt(i)).refresh();
}
public void refreshListeners() {
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-debugger-jpda-projects
private void fireSelectedNodes(Object[] nodes) {
ModelEvent event = new ModelEvent.SelectionChanged(this, nodes);
Vector v = (Vector) listeners.clone ();
int i, k = v.size ();
for (i = 0; i < k; i++) {
((ModelListener) v.get (i)).modelChanged (event);
}
}
内容来源于网络,如有侵权,请联系作者删除!