leap.lang.New.arrayList()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(240)

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

New.arrayList介绍

[英]Create a new empty ArrayList.
[中]创建一个新的空ArrayList。

代码示例

代码示例来源:origin: org.leapframework/leap-lang

/**
 * Converts an iterable into a list. If the iterable is already a list, it is returned. 
 * Otherwise, an {@link java.util.ArrayList} is created with the contents of the iterable in the same iteration order.
 */	
public static <T> List<T> toList(Iterable<T> iterable){
  return iterable instanceof List ? (List<T>)iterable : New.arrayList(iterable);
}

代码示例来源:origin: org.leapframework/leap-lang

/**
 * Converts an iterable into a collection. If the iterable is already a collection, it is returned. Otherwise, an
 * {@link java.util.ArrayList} is created with the contents of the iterable in the same iteration order.
 */
static <E> Collection<E> toCollection(Iterable<E> iterable) {
  return (iterable instanceof Collection) ? (Collection<E>) iterable : New.arrayList(iterable.iterator());
}

代码示例来源:origin: org.leapframework/leap-db

protected AlterTable doDropIndex(String ixName) {
  if(null == indexesToDrop){
    indexesToDrop = New.arrayList(ixName);
  }else{
    indexesToDrop.add(ixName);
  }
  
  return this;
}

代码示例来源:origin: org.leapframework/leap-db

protected AlterTable doDropColumn(String columnName){
  if(null == columnsToDrop){
    columnsToDrop = New.arrayList(columnName);
  }else{
    columnsToDrop.add(columnName);
  }
  
  return this;
}

代码示例来源:origin: org.leapframework/leap-db

protected AlterTable doDropForeignKey(String fkName){
  
  if(null == foreignKeysToDrop){
    foreignKeysToDrop = New.arrayList(fkName);
  }else{
    foreignKeysToDrop.add(fkName);
  }
  
  return this;
}

代码示例来源:origin: org.leapframework/leap-orm

public List<FieldMappingBuilder> getIdFieldMappings() {
  List<FieldMappingBuilder> list = New.arrayList();
  for (FieldMappingBuilder fm : this.fieldMappings) {
    if (fm.isId()) {
      list.add(fm);
    }
  }
  return list;
}

代码示例来源:origin: org.leapframework/leap-lang

/**
 * Parse the json string and converts the raw value to the target type
 * @since 0.5.0b
 */
public static <T> List<T> decodeList(String json, Class<? extends T> valueType){
  T[] obj = decodeArray(json,valueType);
  return New.arrayList(obj);
}

代码示例来源:origin: org.leapframework/leap-webunit

@Override
public List<InetAddress> lookup(String hostname) throws UnknownHostException {
  InetAddress[] addresses = dnsMap.get(hostname);
  if(null != addresses) {
    return New.arrayList(addresses);
  }else{
    return Dns.SYSTEM.lookup(hostname);
  }
}

代码示例来源:origin: org.leapframework/leap-orm

private FieldMapping[] evalKeyFieldMappings() {
  List<FieldMapping> list = New.arrayList();
  for (FieldMapping fm : this.fieldMappings) {
    if (fm.isPrimaryKey()) {
      list.add(fm);
    }
  }
  return list.toArray(new FieldMapping[list.size()]);
}

代码示例来源:origin: org.leapframework/leap-db

@Override
public List<String> getTruncateTableSqls(DbSchemaObjectName tableName) {
  return New.arrayList("TRUNCATE TABLE " + qualifySchemaObjectName(tableName));
}

代码示例来源:origin: org.leapframework/leap-db

@Override
public List<String> getDropSequenceSqls(DbSchemaObjectName sequenceName) throws IllegalStateException {
  return New.arrayList("DROP SEQUENCE IF EXISTS " + qualifySchemaObjectName(sequenceName));
}

代码示例来源:origin: org.leapframework/leap-db

@Override
public List<String> getDropSequenceSqls(DbSchemaObjectName sequenceName) throws IllegalStateException {
  return New.arrayList("DROP SEQUENCE " + qualifySchemaObjectName(sequenceName) + " RESTRICT");
}

代码示例来源:origin: org.leapframework/leap-db

@Override
public List<String> getDropForeignKeySqls(DbSchemaObjectName tableName, String fkName) {
  return New.arrayList("ALTER TABLE " + qualifySchemaObjectName(tableName) + " DROP FOREIGN KEY " + fkName);
}

代码示例来源:origin: org.leapframework/leap-lang

public static <T> List<T> buildList(Iterable<? extends Buildable<T>> builders){
  List<T> list = New.arrayList();
  
  if(null != builders) {
    for(Buildable<T> b : builders){
      list.add(b.build());
    }
  }
  
  return list;
}

代码示例来源:origin: org.leapframework/leap-db

@Override
public List<String> getCreateForeignKeySqls(DbSchemaObjectName tableName, DbForeignKey fk) {
  StringBuilder script = new StringBuilder();
  script.append("ALTER TABLE ").append(qualifySchemaObjectName(tableName)).append(" ADD ");
  if (!Strings.isEmpty(fk.getName())) {
    script.append("CONSTRAINT ").append(quoteIdentifier(fk.getName()));
  }
  script.append(" ").append(getForeignKeyDefinition(fk));
  return New.arrayList(script.toString());
}

代码示例来源:origin: org.leapframework/leap-db

@Override
public List<String> getAlterColumnUniqueSqls(DbSchemaObjectName tableName, String columnName) throws IllegalStateException {
  return New.arrayList("ALTER TABLE " + qualifySchemaObjectName(tableName) +
      " ADD UNIQUE(" + quoteIdentifier(columnName) + ")");
}

代码示例来源:origin: org.leapframework/leap-orm

private FieldMapping[] evalFilterFieldMappings() {
  List<FieldMapping> list = New.arrayList();
  for (FieldMapping fm : this.fieldMappings) {
    if (fm.isFiltered()) {
      Assert.isTrue(null != fm.getFilteredValue(),
          "There filter value expression must not be null of filter field '" + fm.getFieldName() + "'");
      list.add(fm);
    }
  }
  return list.toArray(new FieldMapping[list.size()]);
}

代码示例来源:origin: org.leapframework/leap-db

@Override
public List<String> getDropIndexSqls(DbSchemaObjectName tableName, String ixName) {
  return New.arrayList("DROP INDEX " + qualifySchemaObjectName(tableName.getCatalog(), tableName.getSchema(), ixName));
}

代码示例来源:origin: org.leapframework/leap-db

@Override
public List<String> getDropSequenceSqls(DbSchemaObjectName sequenceName) throws IllegalStateException {
  if (!supportsSequence()) {
    throw notSupportsSequence();
  } else {
    return New.arrayList("DROP SEQUENCE " + qualifySchemaObjectName(sequenceName));
  }
}

代码示例来源:origin: org.leapframework/leap-db

@Override
public List<String> getCreateColumnSqls(DbSchemaObjectName tableName, DbColumn column) {
  List<String> sqls =
      New.arrayList(getAddColumnSqlPrefix(tableName, column) + getColumnDefinitionForAlterTable(column));
  if (supportsColumnComment() && !supportsColumnCommentInDefinition()) {
    if (!Strings.isEmpty(column.getComment())) {
      sqls.addAll(getCommentOnColumnSqls(tableName, column.getName(), column.getComment()));
    }
  }
  return sqls;
}

相关文章