java.util.Collections.fill()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(173)

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

Collections.fill介绍

[英]Fills the specified list with the specified element.
[中]用指定的元素填充指定的列表。

代码示例

代码示例来源:origin: stackoverflow.com

List<Boolean> list=new ArrayList<Boolean>(Arrays.asList(new Boolean[10]));
Collections.fill(list, Boolean.TRUE);

代码示例来源:origin: bumptech/glide

@NonNull
@Override
public List<Object> getPreloadItems(int position) {
 ArrayList<Object> result = new ArrayList<>(1);
 Collections.fill(result, new Object());
 return result;
}

代码示例来源:origin: forcedotcom/phoenix

@Override
public void clearParameters() throws SQLException {
  Collections.fill(parameters, BindManager.UNBOUND_PARAMETER);
}

代码示例来源:origin: apache/phoenix

@Override
public void clearParameters() throws SQLException {
  Collections.fill(parameters, BindManager.UNBOUND_PARAMETER);
}

代码示例来源:origin: org.apache.lucene/lucene-core

@SuppressWarnings("try")
private synchronized void closeMergeReaders(MergePolicy.OneMerge merge, boolean suppressExceptions) throws IOException {
 final boolean drop = suppressExceptions == false;
 try (Closeable finalizer = merge::mergeFinished) {
  IOUtils.applyToAll(merge.readers, sr -> {
   final ReadersAndUpdates rld = getPooledInstance(sr.getOriginalSegmentInfo(), false);
   // We still hold a ref so it should not have been removed:
   assert rld != null;
   if (drop) {
    rld.dropChanges();
   } else {
    rld.dropMergingUpdates();
   }
   rld.release(sr);
   release(rld);
   if (drop) {
    readerPool.drop(rld.info);
   }
  });
 } finally {
  Collections.fill(merge.readers, null);
 }
}

代码示例来源:origin: konsoletyper/teavm

Collections.fill(definedVersions, null);
Task task = stack.pop();

代码示例来源:origin: forcedotcom/phoenix

public PhoenixPreparedStatement(PhoenixConnection connection, String query) throws SQLException {
  super(connection);
  this.query = query;
  this.statement = parseStatement(query);
  this.parameters = Arrays.asList(new Object[statement.getBindCount()]);
  Collections.fill(parameters, BindManager.UNBOUND_PARAMETER);
}

代码示例来源:origin: forcedotcom/phoenix

public PhoenixPreparedStatement(PhoenixConnection connection, PhoenixStatementParser parser) throws SQLException,
    IOException {
  super(connection);
  this.statement = parser.nextStatement(new ExecutableNodeFactory());
  if (this.statement == null) { throw new EOFException(); }
  this.query = null; // TODO: add toString on SQLStatement
  this.parameters = Arrays.asList(new Object[statement.getBindCount()]);
  Collections.fill(parameters, BindManager.UNBOUND_PARAMETER);
}

代码示例来源:origin: apache/phoenix

public PhoenixPreparedStatement(PhoenixConnection connection, String query) throws SQLException {
  super(connection);
  this.query = query;
  this.statement = parseStatement(query);
  this.parameterCount = statement.getBindCount();
  this.parameters = Arrays.asList(new Object[statement.getBindCount()]);
  Collections.fill(parameters, BindManager.UNBOUND_PARAMETER);
}

代码示例来源:origin: apache/phoenix

public PhoenixPreparedStatement(PhoenixConnection connection, PhoenixStatementParser parser) throws SQLException, IOException {
  super(connection);
  this.statement = parser.nextStatement(new ExecutableNodeFactory());
  if (this.statement == null) { throw new EOFException(); }
  this.query = null; // TODO: add toString on SQLStatement
  this.parameterCount = statement.getBindCount();
  this.parameters = Arrays.asList(new Object[statement.getBindCount()]);
  Collections.fill(parameters, BindManager.UNBOUND_PARAMETER);
}

代码示例来源:origin: stackoverflow.com

public void changeValues(int x){   
 int length = arrayList.size();
 Collections.fill(arrayList, Boolean.TRUE);
 for(int a = 0; a < length; a += x){
   arrayList.set(a, Boolean.FALSE);
 }
 System.out.print(arrayList);
}

代码示例来源:origin: com.google.javascript/closure-compiler

private void reset() {
 isLooseMatch = false;
 Collections.fill(localVarMatches, null);
 for (int i = 0; i < paramNodeMatches.size(); i++) {
  this.paramNodeMatches.set(i, null);
 }
}

代码示例来源:origin: BruceEckel/OnJava8-Examples

public static void main(String[] args) {
  List<StringAddress> list = new ArrayList<>(
   Collections.nCopies(4,
    new StringAddress("Hello")));
  System.out.println(list);
  Collections.fill(list,
   new StringAddress("World!"));
  System.out.println(list);
 }
}

代码示例来源:origin: stackoverflow.com

// apparently this is broken. Whoops for me!
java.util.Collections.fill(list,new Integer(0));

// this is better
Integer[] data = new Integer[60];
Arrays.fill(data,new Integer(0));
List<Integer> list = Arrays.asList(data);

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-common

public final boolean setAll(final Object _v) {
 if (_v instanceof Boolean) {
  Collections.fill(list_, _v);
  fireObjectChanged();
  return true;
 }
 return false;
}

代码示例来源:origin: com.github.steveash.kylm/kylm

@Override
public void setChildren(Vector<NgramNode> newChildren) {
  if (parent == null) {
    Collections.fill(children, null);
    for (NgramNode child : newChildren)
      children.set(child.getId(), child);
  } else
    children = new Vector<NgramNode>(newChildren);
  childCount = newChildren.size();
}

代码示例来源:origin: org.apache.phoenix/phoenix-core

public PhoenixPreparedStatement(PhoenixConnection connection, String query) throws SQLException {
  super(connection);
  this.query = query;
  this.statement = parseStatement(query);
  this.parameterCount = statement.getBindCount();
  this.parameters = Arrays.asList(new Object[statement.getBindCount()]);
  Collections.fill(parameters, BindManager.UNBOUND_PARAMETER);
}

代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core

public PhoenixPreparedStatement(PhoenixConnection connection, String query) throws SQLException {
  super(connection);
  this.query = query;
  this.statement = parseStatement(query);
  this.parameterCount = statement.getBindCount();
  this.parameters = Arrays.asList(new Object[statement.getBindCount()]);
  Collections.fill(parameters, BindManager.UNBOUND_PARAMETER);
}

代码示例来源:origin: org.apache.phoenix/phoenix-core

public PhoenixPreparedStatement(PhoenixConnection connection, PhoenixStatementParser parser) throws SQLException, IOException {
  super(connection);
  this.statement = parser.nextStatement(new ExecutableNodeFactory());
  if (this.statement == null) { throw new EOFException(); }
  this.query = null; // TODO: add toString on SQLStatement
  this.parameterCount = statement.getBindCount();
  this.parameters = Arrays.asList(new Object[statement.getBindCount()]);
  Collections.fill(parameters, BindManager.UNBOUND_PARAMETER);
}

代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core

public PhoenixPreparedStatement(PhoenixConnection connection, PhoenixStatementParser parser) throws SQLException, IOException {
  super(connection);
  this.statement = parser.nextStatement(new ExecutableNodeFactory());
  if (this.statement == null) { throw new EOFException(); }
  this.query = null; // TODO: add toString on SQLStatement
  this.parameterCount = statement.getBindCount();
  this.parameters = Arrays.asList(new Object[statement.getBindCount()]);
  Collections.fill(parameters, BindManager.UNBOUND_PARAMETER);
}

相关文章

Collections类方法