本文整理匯總了Java中com.beust.jcommander.internal.Lists.newLinkedList方法的典型用法代碼示例。如果您正苦於以下問題:Java Lists.newLinkedList方法的具體用法?Java Lists.newLinkedList怎麽用?Java Lists.newLinkedList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.beust.jcommander.internal.Lists
的用法示例。
在下文中一共展示了Lists.newLinkedList方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getPublicDnsForAutoScalingGroup
import com.beust.jcommander.internal.Lists; //導入方法依賴的package包/類
/**
* For a given AutoScaling group logical id, get the public dns names associated with each instance.
*
* @param logicalId AutoScaling group logical id
* @return List of public dns names
*/
public List<String> getPublicDnsForAutoScalingGroup(final String logicalId) {
final List<String> instanceIds = Lists.newLinkedList();
final Optional<AutoScalingGroup> autoScalingGroup = describeAutoScalingGroup(logicalId);
final List<String> publicDnsNames = Lists.newLinkedList();
if (autoScalingGroup.isPresent()) {
autoScalingGroup.get()
.getInstances().stream().forEach(instance -> instanceIds.add(instance.getInstanceId()));
final DescribeInstancesRequest describeInstancesRequest = new DescribeInstancesRequest()
.withInstanceIds(instanceIds);
final DescribeInstancesResult describeInstancesResult =
ec2Client.describeInstances(describeInstancesRequest);
describeInstancesResult.getReservations().forEach(reservation ->
reservation.getInstances().stream().forEach(instance ->
publicDnsNames.add(instance.getPublicDnsName()))
);
}
return publicDnsNames;
}
示例2: listOfString
import com.beust.jcommander.internal.Lists; //導入方法依賴的package包/類
@Test
public void listOfString() {
createTable("CREATE TABLE table1 (id INT PRIMARY KEY, data TEXT)");
this.addConfigHook(c ->
c.setConverter("table1", "data", new ObjectToJsonStringConverter(List.class, new TypeReference<List<String>>() {
})));
Table t1 = lSql.table("table1");
List<String> list = Lists.newLinkedList();
list.add("first");
list.add("second");
t1.insert(Row.fromKeyVals("id", 1, "data", list));
Row row = t1.load(1).get();
assertEquals(row.get("data"), list);
}
示例3: listOfMapStringString
import com.beust.jcommander.internal.Lists; //導入方法依賴的package包/類
@Test
public void listOfMapStringString() {
createTable("CREATE TABLE table1 (id INT PRIMARY KEY, data TEXT)");
this.addConfigHook(c ->
c.setConverter("table1", "data", new ObjectToJsonStringConverter(List.class, new TypeReference<List<Map<String, String>>>() {
})));
Table t1 = lSql.table("table1");
List<Map<String, String>> list = Lists.newLinkedList();
Map<String, String> e = Maps.newHashMap();
e.put("a", "1");
e.put("b", "2");
list.add(e);
list.add(e);
t1.insert(Row.fromKeyVals("id", 1, "data", list));
Row row = t1.load(1).get();
assertEquals(row.get("data"), list);
}
示例4: listOfMapStringStringInALinkedRow
import com.beust.jcommander.internal.Lists; //導入方法依賴的package包/類
@Test
public void listOfMapStringStringInALinkedRow() {
createTable("CREATE TABLE table1 (id SERIAL PRIMARY KEY, data TEXT)");
this.addConfigHook(c ->
c.setConverter(
"table1",
"data",
new ObjectToJsonStringConverter(List.class, new TypeReference<List<Map<String, String>>>() {
})));
Table t1 = lSql.table("table1");
List<Map<String, String>> list = Lists.newLinkedList();
Map<String, String> e = Maps.newHashMap();
e.put("a", "1");
e.put("b", "2");
list.add(e);
list.add(e);
t1.newLinkedRow("id", 1, "data", list).save();
Row row = t1.load(1).get();
assertEquals(row.get("data"), list);
}
示例5: run
import com.beust.jcommander.internal.Lists; //導入方法依賴的package包/類
@Override
public void run(VaultHealthCheckCommand command) {
List<String> msgList = Lists.newLinkedList();
boolean toggle = false;
do {
final List<VaultAdminClient> clients = vaultAdminClientFactory.getClientsForCluster();
clients.forEach(client -> {
try {
VaultHealthResponse response = client.health();
msgList.add(String.format("%s: Initialized: %s, Sealed: %s, Standby: %s",
client.getVaultUrl(),
colorify(response.isInitialized()),
colorify(response.isSealed()),
colorify(response.isStandby())));
} catch (Throwable t) {
msgList.add(String.format("ERROR: %s", t.getMessage()));
}
});
String sym = toggle ? "*" : "+";
sym = StringUtils.repeat(sym, 20);
if (command.isPoll()) {
logger.info(Ansi.eraseScreen());
}
logger.info(String.format("%s - Vault Health Status - %s", sym, sym));
msgList.forEach(logger::info);
msgList.clear();
toggle = !toggle;
try {
Thread.sleep(TimeUnit.SECONDS.toMillis(1));
} catch (InterruptedException e) {
break;
}
} while (command.isPoll());
}
示例6: addExperiment
import com.beust.jcommander.internal.Lists; //導入方法依賴的package包/類
@Override
public void addExperiment(String sutId, DriverAndIndependentVars l)
{
List<DriverAndIndependentVars> t = experiments.get(sutId);
if (t == null)
t = Lists.newLinkedList();
t.add(l);
experiments.put(sutId, t);
}