本文整理汇总了Java中com.google.api.client.util.Lists类的典型用法代码示例。如果您正苦于以下问题:Java Lists类的具体用法?Java Lists怎么用?Java Lists使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Lists类属于com.google.api.client.util包,在下文中一共展示了Lists类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUrlForGettingDoc
import com.google.api.client.util.Lists; //导入依赖的package包/类
public String getUrlForGettingDoc(String q, List<String> languages, String dataSetId)
{
List<NameValuePair> parameters = Lists.newArrayList();
parameters.add(new BasicNameValuePair("q", getPhraseQueryString(q)));
parameters.add(new BasicNameValuePair("defType", "edismax"));
parameters.add(new BasicNameValuePair("lowercaseOperators", "false"));
parameters.add(new BasicNameValuePair("rows", "100000"));
parameters.add(new BasicNameValuePair("qs", "10"));
parameters.add(new BasicNameValuePair("fl", Properties.idField.get() + ", " + Properties.titleFields.get().get(0) + "_en"));
parameters.add(new BasicNameValuePair("sort", Properties.idField.get() + " DESC"));
parameters.add(new BasicNameValuePair("qf", getQueryFields(languages)));
parameters.add(new BasicNameValuePair("fq", Properties.docTypeFieldName.get() + ":" + dataSetId));
parameters.add(new BasicNameValuePair("wt", "json"));
return getServerUrl() + "/select?" + URLEncodedUtils.format(parameters, BaseIndexer.ENCODING);
}
示例2: getBookmarkFiles
import com.google.api.client.util.Lists; //导入依赖的package包/类
@Override
public List<File> getBookmarkFiles() throws IOException {
List<File> files = Lists.newArrayList();
String pageToken = null;
do {
StringBuilder query = new StringBuilder("mimeType='"+BookmarkFileConstants.MESFAVORIS_MIME_TYPE+"' and trashed=false");
if (folderId.isPresent()) {
query.append(String.format(" and '%s' in parents", folderId.get()));
}
FileList result = drive.files().list()
.setQ(query.toString())
.setSpaces("drive")
.setPageToken(pageToken)
.execute();
files.addAll(result.getItems());
pageToken = result.getNextPageToken();
} while (pageToken != null);
return files;
}
示例3: testGetReadsFromHadoopBam
import com.google.api.client.util.Lists; //导入依赖的package包/类
@Test
public void testGetReadsFromHadoopBam() {
String dataflowRunner = DataflowCommandLineProgramTest.getExternallySpecifiedRunner();
if (!SparkPipelineRunner.class.getSimpleName().equals(dataflowRunner)) {
return; // only run if SparkPipelineRunner specified
}
List<SimpleInterval> intervals = Arrays.asList(new SimpleInterval("chr7:1-202"), new SimpleInterval("chr8:2-202"));
File inputFile = new File(getToolTestDataDir(), "example_reads.bam");
List<GATKRead> expected = getReadsFromFile(intervals, inputFile, false);
Pipeline p = GATKTestPipeline.create();
DataflowUtils.registerGATKCoders(p);
PCollection<GATKRead> reads = DataflowUtils.getReadsFromHadoopBam(p, intervals, ValidationStringency.SILENT,
new Path(inputFile.getAbsoluteFile().toURI()).toString());
EvaluationResult result = SparkPipelineRunner.create().run(p);
Assert.assertTrue(ReadUtils.readListsAreEqualIgnoreUUID(expected, Lists.newArrayList(result.get(reads))), "Actual reads do not match expected reads");
}
示例4: flattenPColl
import com.google.api.client.util.Lists; //导入依赖的package包/类
private static <T> TransformEvaluator<Flatten.FlattenPCollectionList<T>> flattenPColl() {
return new TransformEvaluator<Flatten.FlattenPCollectionList<T>>() {
@SuppressWarnings("unchecked")
@Override
public void evaluate(Flatten.FlattenPCollectionList<T> transform, EvaluationContext context) {
StreamingEvaluationContext sec = (StreamingEvaluationContext) context;
PCollectionList<T> pcs = sec.getInput(transform);
JavaDStream<WindowedValue<T>> first =
(JavaDStream<WindowedValue<T>>) sec.getStream(pcs.get(0));
List<JavaDStream<WindowedValue<T>>> rest = Lists.newArrayListWithCapacity(pcs.size() - 1);
for (int i = 1; i < pcs.size(); i++) {
rest.add((JavaDStream<WindowedValue<T>>) sec.getStream(pcs.get(i)));
}
JavaDStream<WindowedValue<T>> dstream = sec.getStreamingContext().union(first, rest);
sec.setStream(transform, dstream);
}
};
}
示例5: getBackgroundDebugStates
import com.google.api.client.util.Lists; //导入依赖的package包/类
private List<CloudDebugProcessState> getBackgroundDebugStates(Project project) {
List<CloudDebugProcessState> states = Lists.newArrayList();
RunManager manager = RunManager.getInstance(project);
for (final RunnerAndConfigurationSettings config : manager.getAllSettings()) {
if (config.getConfiguration() instanceof CloudDebugRunConfiguration) {
final CloudDebugRunConfiguration cloudConfig =
(CloudDebugRunConfiguration) config.getConfiguration();
CloudDebugProcessState processState = cloudConfig.getProcessState();
if (processState != null && processState.isListenInBackground()) {
states.add(processState);
}
}
}
return states;
}
示例6: testRegisterAdditionalActions_close
import com.google.api.client.util.Lists; //导入依赖的package包/类
public void testRegisterAdditionalActions_close() {
ActionManager manager = ActionManager.getInstance();
AnAction action0 = manager.getAction(IdeActions.ACTION_PIN_ACTIVE_TAB);
AnAction action1 = manager.getAction(IdeActions.ACTION_CLOSE);
action1.getTemplatePresentation().setText("Close");
AnAction action2 = manager.getAction(IdeActions.ACTION_CONTEXT_HELP);
AnAction action3 = manager.getAction(IdeActions.ACTION_CALL_HIERARCHY);
List<AnAction> leftToolbarActions = Lists.newArrayList();
leftToolbarActions.add(action0);
leftToolbarActions.add(action1);
leftToolbarActions.add(action2);
leftToolbarActions.add(action3);
DefaultActionGroup leftToolbar = new DefaultActionGroup(leftToolbarActions);
List<AnAction> actions = Lists.newArrayList();
DefaultActionGroup topToolbar = new DefaultActionGroup(actions);
DefaultActionGroup settings = new DefaultActionGroup(actions);
process.registerAdditionalActions(leftToolbar, topToolbar, settings);
assertEquals(4, leftToolbar.getChildrenCount());
assertEquals(action0, leftToolbar.getChildActionsOrStubs()[0]);
assertEquals(action3, leftToolbar.getChildActionsOrStubs()[1]);
}
示例7: assertRemoveFromLeftToolbar
import com.google.api.client.util.Lists; //导入依赖的package包/类
private void assertRemoveFromLeftToolbar(String actionId) {
ActionManager manager = ActionManager.getInstance();
AnAction action = manager.getAction(actionId);
List<AnAction> leftToolbarActions = Lists.newArrayList();
leftToolbarActions.add(action);
DefaultActionGroup leftToolbar = new DefaultActionGroup(leftToolbarActions);
List<AnAction> actions = Lists.newArrayList();
DefaultActionGroup topToolbar = new DefaultActionGroup(actions);
DefaultActionGroup settings = new DefaultActionGroup(actions);
process.registerAdditionalActions(leftToolbar, topToolbar, settings);
assertEquals(1, leftToolbar.getChildrenCount());
AnAction actual = leftToolbar.getChildActionsOrStubs()[0];
assertEquals(
"Stop IDE Debugging. (Exit debug mode and continue the debug session later.)",
actual.toString());
}
示例8: importMail
import com.google.api.client.util.Lists; //导入依赖的package包/类
public void importMail() throws MessagingException, IOException {
LocalStorage storage = storageProvider.get();
gmailSyncer.init();
int messagesImported = 0;
Iterator<LocalMessage> iterator = storage.iterator();
while (iterator.hasNext() && keepImporting(messagesImported)) {
List<LocalMessage> batch = Lists.newArrayListWithCapacity(BATCH_SIZE);
for (int i = 0;
i < BATCH_SIZE
&& iterator.hasNext()
&& keepImporting(messagesImported);
i++) {
LocalMessage message = iterator.next();
logger.fine(() -> "Id: " + message.getMessageId());
logger.fine(() -> "Folders: " + message.getFolders());
batch.add(message);
messagesImported++;
}
gmailSyncer.sync(batch);
}
}
示例9: upgradeV3ToV4
import com.google.api.client.util.Lists; //导入依赖的package包/类
private void upgradeV3ToV4(List<Config> configs) {
List<Config> configsToRemove = new ArrayList<>();
String geoIP2DBFile = null;
String geoIP2DBType = null;
for (Config config : configs) {
switch (config.getName()) {
case "geoIP2DBFile":
configsToRemove.add(config);
geoIP2DBFile = config.getValue().toString();
break;
case "geoIP2DBType":
configsToRemove.add(config);
geoIP2DBType = config.getValue().toString();
break;
}
}
configs.removeAll(configsToRemove);
List<Map<String, String>> dbConfigs = Lists.newArrayList();
Map<String, String> dbConfig = ImmutableMap.of("geoIP2DBFile", geoIP2DBFile, "geoIP2DBType", geoIP2DBType);
dbConfigs.add(dbConfig);
configs.add(new Config("dbConfigs", dbConfigs));
}
示例10: queryData
import com.google.api.client.util.Lists; //导入依赖的package包/类
private static void queryData(final Datastore datastore) {
final Query get = QueryBuilder.query()
.kindOf("employee")
.filterBy(eq("age", 40))
.orderBy(asc("fullname"));
List<Entity> entities = Lists.newArrayList();
try {
entities = datastore.execute(get).getAll();
} catch (final DatastoreException e) {
System.err.println("Storage exception: " + Throwables.getRootCause(e).getMessage());
}
for (final Entity entity : entities) {
System.out.println("Employee name: " + entity.getString("fullname"));
System.out.println("Employee age: " + entity.getInteger("age"));
}
}
示例11: listRegions
import com.google.api.client.util.Lists; //导入依赖的package包/类
@Override
public List<Region> listRegions()
{
List<Region> regions = Lists.newArrayList();
Compute.Zones.List zones = compute.zones().list(credentials_.getProject());
ZoneList zoneList = zones.execute();
for (Zone zone : zoneList.getItems())
{
regions.add(new Region(zone.getName())
.setEndpoint(zone.getSelfLink())
.setId(zone.getId().intValue())
.setStatus(RegionStatus.valueOf(zone.getStatus())));
}
return Collections.unmodifiableList(regions);
}
示例12: getBootDisk
import com.google.api.client.util.Lists; //导入依赖的package包/类
protected Disk getBootDisk(Instance instance)
{
AttachedDisk bootDisk = Lists.newArrayList(Iterables.filter(instance.getDisks(), new Predicate<AttachedDisk>()
{
@Override
public boolean apply(@Nullable AttachedDisk input)
{
return input != null && input.getBoot();
}
})).get(0);
//https://www.googleapis.com/compute/v1/projects/poised-bot-553/zones/us-central1-a/disks/f1-micro-test
//persistent-disk-0
// I removed this constraint because of a possible bug in the Google Compute Engine, since it is not setting the correct name of the disk.
// This issue is also occurring at the google client. Above we have an example of the returned values;
// Preconditions.checkState(Objects.equal(splitAndGetLast("/", bootDisk.getSource()), bootDisk.getDeviceName()));
// return getDisk(splitAndGetLast("/", instance.getZone()), bootDisk.getDeviceName());
return getDisk(splitAndGetLast("/", instance.getZone()), splitAndGetLast("/", bootDisk.getSource()));
}
示例13: testBase
import com.google.api.client.util.Lists; //导入依赖的package包/类
private void testBase(String[] ARGS, GraphResult[] expectedResult) throws Exception {
// Run the pipeline.
VariantSimilarity.main(ARGS);
// Download the pipeline results.
List<String> rawResults = helper.downloadOutputs(outputPrefix, expectedResult.length);
List<GraphResult> results = Lists.newArrayList();
for (String result : rawResults) {
results.add(GraphResult.fromString(result));
}
// Check the pipeline results.
assertEquals(expectedResult.length, results.size());
assertThat(results,
CoreMatchers.allOf(CoreMatchers.hasItems(expectedResult)));
}
示例14: getRecent
import com.google.api.client.util.Lists; //导入依赖的package包/类
public List<String> getRecent(int size) {
List<String> recent = Lists.newArrayList();
List<String> currentEntries = evictingQueue.stream().collect(Collectors.toList());
Collections.reverse(currentEntries);
int i = 0;
for (String s : currentEntries) {
if (i < size) {
recent.add(s);
i++;
} else {
break;
}
}
Collections.reverse(recent);
return recent;
}
示例15: process
import com.google.api.client.util.Lists; //导入依赖的package包/类
@Override
public List<String> process() {
Map<Integer, Room> getrooms = botCommandManager.getGameManager().getRoomManager().getrooms();
int size = getrooms.size();
int randomRoomNumber = randInt(1, size);
Room randomRoom = getrooms.get(randomRoomNumber);
ArrayList<String> output = Lists.newArrayList();
output.add(randomRoom.getRoomTitle());
output.add(" ");
output.add(randomRoom.getRoomDescription());
/*String mapString = botCommandManager.getGameManager().getMapsManager().drawMap(randomRoom.getRoomId(), new Coords(5, 5));
String[] split = mapString.split("\\r?\\n");
for (String s: split) {
output.add(s);
}*/
return output;
}