本文整理匯總了Java中java.util.List.remove方法的典型用法代碼示例。如果您正苦於以下問題:Java List.remove方法的具體用法?Java List.remove怎麽用?Java List.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.List
的用法示例。
在下文中一共展示了List.remove方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: replacePlaceholders
import java.util.List; //導入方法依賴的package包/類
public static String replacePlaceholders(String text, List<Map<String, String>> list, ScriptContext context) {
if (text == null) {
return null;
}
if (list == null) {
return text;
}
for (Map<String, String> map : list) {
String token = map.get(TOKEN);
if (token == null) {
continue;
}
// the verbosity below is to be lenient with table second column name
List<String> keys = new ArrayList(map.keySet());
keys.remove(TOKEN);
Iterator<String> iterator = keys.iterator();
if (iterator.hasNext()) {
String key = keys.iterator().next();
String value = map.get(key);
text = replacePlaceholderText(text, token, value, context);
}
}
return text;
}
示例2: removeDataDisks
import java.util.List; //導入方法依賴的package包/類
private void removeDataDisks() {
VirtualMachineScaleSetStorageProfile storageProfile = this.vmss
.inner()
.virtualMachineProfile()
.storageProfile();
List<VirtualMachineScaleSetDataDisk> dataDisks = storageProfile.dataDisks();
for (Integer lun : this.diskLunsToRemove) {
int indexToRemove = 0;
for (VirtualMachineScaleSetDataDisk dataDisk : dataDisks) {
if (dataDisk.lun() == lun) {
dataDisks.remove(indexToRemove);
break;
}
indexToRemove++;
}
}
}
示例3: getNextRequest
import java.util.List; //導入方法依賴的package包/類
private HttpPipelineRequest getNextRequest(List<HttpPipelineRequest> p_getNextRequest_1_, boolean p_getNextRequest_2_) throws InterruptedException
{
while (p_getNextRequest_1_.size() <= 0)
{
this.checkTimeout();
this.wait(1000L);
}
this.onActivity();
if (p_getNextRequest_2_)
{
return (HttpPipelineRequest)p_getNextRequest_1_.remove(0);
}
else
{
return (HttpPipelineRequest)p_getNextRequest_1_.get(0);
}
}
示例4: deleteStepOnPositionAndCheckRest
import java.util.List; //導入方法依賴的package包/類
@Then("^she delete step on position \"(\\d+)\" and check rest$")
public void deleteStepOnPositionAndCheckRest(Integer positionOfStep) {
log.info("Deleting step on position {}", positionOfStep);
List<String> list = editPage.getFlowViewComponent().getStepsArray();
ElementsCollection deletes = this.editPage.getFlowViewComponent().getAllTrashes().shouldBe(sizeGreaterThanOrEqual(1));
Integer indexOfStep = positionOfStep + 1;
deletes.get(indexOfStep).click();
editPage.clickOnFirstVisibleButton("OK");
list.remove(positionOfStep);
//NOW CHECK:
List<String> list2 = editPage.getFlowViewComponent().getStepsArray();
for (int i = 0; i < list.size(); i++) {
log.info("assserting {} and {}", list.get(i), list2.get(i));
assertThat(list.get(i), is(list2.get(i)));
}
}
示例5: pullGamesFromNetwork
import java.util.List; //導入方法依賴的package包/類
@Override
public List<Game> pullGamesFromNetwork(Context context) throws IOException, ExpectedElementNotFound {
this.context = context;
if (context != null) {
Log.e(TAG, "Started " + getAcronym() + " " + getScoreType());
}
List<Game> updatedGameList = new LinkedList<>();
Document parsedDocument = Jsoup.connect(getBaseUrl()).timeout(60 * 1000).get();
updatedGameList = scrapeUpdateGamesFromParsedDocument(updatedGameList, parsedDocument);
if (context != null) {
storeDocument(parsedDocument);
// Only add dates that are scheduled for that date.
List<Game> tempList = new LinkedList<>(updatedGameList);
for (Game game : tempList) {
if (game.getGameAddDate() != new DateTime(Constants.DATE.VEGAS_TIME_ZONE).withTimeAtStartOfDay().getMillis()
// || new DateTime(game.getGameDateTime(), Constants.DATE.VEGAS_TIME_ZONE).toDateTime(DateTimeZone.getDefault()).isBeforeNow()
) {
updatedGameList.remove(game);
}
}
// Initiate teams for this league if not initiated
syncDateWithEspn(updatedGameList);
}
updateLibraryInDatabase(updatedGameList, context);
return updatedGameList;
}
示例6: testRemoveAtIndexFromGetPropagates
import java.util.List; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(SEVERAL)
public void testRemoveAtIndexFromGetPropagates() {
List<V> values = Arrays.asList(v0(), v1(), v0());
for (int i = 0; i < 3; i++) {
resetContainer(mapEntry(k0(), v0()), mapEntry(k0(), v1()), mapEntry(k0(), v0()));
List<V> expectedValues = copyToList(values);
multimap().get(k0()).remove(i);
expectedValues.remove(i);
assertGet(k0(), expectedValues);
}
}
示例7: compareMixedLists
import java.util.List; //導入方法依賴的package包/類
private boolean compareMixedLists( List<String> expected, List<String> actual ) {
for (String name : expected) {
for (int i = 0; i < actual.size(); i++) {
if (actual.get(i).trim().equals(name.trim())) {
actual.remove(i);
break;
} else if (i == actual.size() - 1) {
return false;
}
}
}
return actual.isEmpty();
}
示例8: getPersistentData
import java.util.List; //導入方法依賴的package包/類
public PersistentDataSoloRoleplayGame getPersistentData() {
PersistentDataSoloRoleplayGame result = new PersistentDataSoloRoleplayGame();
result.setChapter(lastChapter);
result.setStep(lastStep);
result.setReturnChapter(returnChapter);
result.setReturnStep(returnStep);
List<String> historyCopy = new ArrayList<String>(history);
while(historyCopy.size() > lastHistorySize) {
historyCopy.remove(historyCopy.size()-1);
}
result.setHistory(historyCopy);
return result;
}
示例9: test
import java.util.List; //導入方法依賴的package包/類
private void test(int n, int k) {
final List<Integer> sequence = StreamUtil.sequence(n);
final List<Integer> subset = ComputeRandomSubset.randomSubset(n, k);
assertNotEquals(sequence, subset);
assertEquals(k, subset.size());
for (Integer i : subset) {
assertTrue(sequence.contains(i));
sequence.remove(i);
}
}
開發者ID:gardncl,項目名稱:elements-of-programming-interviews-solutions,代碼行數:11,代碼來源:ComputeRandomSubsetTest.java
示例10: onTab
import java.util.List; //導入方法依賴的package包/類
@Override
public List<String> onTab(VPSender sender, String label, List<String> args) {
if ( args == null ) args = new ArrayList<>();
List<String>result = new ArrayList<>();
if (!otherAtEnd && args.size() < 2 && otherRequirement.has(sender) ) {
result.addAll(VanillaPlusCore.getPlayerManager().getPlayersList(args.isEmpty() ? "" : args.get(0), online));
result.remove(sender.getName());
}
return result;
}
示例11: unregisterMonotonousConsumer
import java.util.List; //導入方法依賴的package包/類
public static void unregisterMonotonousConsumer(TickConsumer c) {
synchronized (instance)
{
List new_list = new ArrayList(monotoneTimeConsumers);
new_list.remove(c);
monotoneTimeConsumers = new_list;
}
}
示例12: deleteFileTreeWithRetry
import java.util.List; //導入方法依賴的package包/類
/**
* Deletes a directory and its subdirectories, retrying if necessary.
*
* @param dir the directory to delete
*
* @throws IOException
* If an I/O error occurs. Any such exceptions are caught
* internally. If only one is caught, then it is re-thrown.
* If more than one exception is caught, then the second and
* following exceptions are added as suppressed exceptions of the
* first one caught, which is then re-thrown.
*/
public static void deleteFileTreeWithRetry(Path dir)
throws IOException
{
IOException ioe = null;
final List<IOException> excs = deleteFileTreeUnchecked(dir);
if (!excs.isEmpty()) {
ioe = excs.remove(0);
for (IOException x : excs)
ioe.addSuppressed(x);
}
if (ioe != null)
throw ioe;
}
示例13: endChangeAnimation
import java.util.List; //導入方法依賴的package包/類
private void endChangeAnimation(List<ChangeInfo> infoList, ViewHolder item) {
for (int i = infoList.size() - 1; i >= 0; i--) {
ChangeInfo changeInfo = infoList.get(i);
if (endChangeAnimationIfNecessary(changeInfo, item)) {
if (changeInfo.oldHolder == null && changeInfo.newHolder == null) {
infoList.remove(changeInfo);
}
}
}
}
示例14: execute
import java.util.List; //導入方法依賴的package包/類
@Override
protected void execute(CommandEvent event) {
if (!StringUtils.isBlank(event.getArgs()) && event.getArgs().split(" ").length >= 2) {
String teamArg = event.getArgs().split(" ")[0];
List<String> userArgs = new ArrayList<String>(Arrays.asList(event.getArgs().split(" ")));
userArgs.remove(0);
BeamTeam team = CommandHelper.getTeam(event, teamArg);
if (null != team) {
List<BeamTeamUser> teamMembers = BeamManager.getTeamMembers(team);
for (String userArg : userArgs) {
StringBuilder followingList = new StringBuilder();
StringBuilder notFollowingList = new StringBuilder();
int followingCount = 0, notFollowingCount = 0;
BTBBeamUser user = BeamManager.getUser(userArg);
List<BTBBeamChannel> userFollows = BeamManager.getFollowing(user);
for (BeamTeamUser member : teamMembers) {
if (!member.equals(user)) {
boolean isNotFollowingMember = true;
for (BTBBeamChannel followee : userFollows) {
if (member.channel.id == followee.id) {
followingList.append(String.format("[%s](https://beam.pro/%s)\n", member.username,
member.username));
isNotFollowingMember = false;
++followingCount;
break;
} else if (member.channel.id < followee.id) {
break;
}
}
if (isNotFollowingMember) {
notFollowingList.append(
String.format("[%s](https://beam.pro/%s)\n", member.username, member.username));
++notFollowingCount;
}
}
}
if (followingCount == 0) {
followingList.append("NONE");
}
if (notFollowingCount == 0) {
notFollowingList.append("NONE");
}
CommandHelper.sendPaginationDM(event, followingList.toString().split("\n"), 1,
"%s is Following %d/%d %s Members", user.username, followingCount, teamMembers.size(),
team.name);
CommandHelper.sendPaginationDM(event, notFollowingList.toString().split("\n"), 1,
"%s is Not Following %d/%d %s Members", user.username, notFollowingCount,
teamMembers.size(), team.name);
}
}
} else {
JDAManager.sendMessage(event, "Missing arguments from command!");
}
}
示例15: visitTry
import java.util.List; //導入方法依賴的package包/類
public @Override Void visitTry(TryTree tt, Void p) {
List<CatchTree> catches = new ArrayList<CatchTree>();
catches.addAll(tt.getCatches());
catches.addAll(createCatches(info, make, thandles, statement));
if (!streamAlike) {
info.rewrite(tt, make.Try(tt.getResources(), tt.getBlock(), catches, tt.getFinallyBlock()));
} else {
VariableTree originalDeclaration = (VariableTree) statement.getLeaf();
VariableTree declaration = make.Variable(make.Modifiers(EnumSet.noneOf(Modifier.class)), originalDeclaration.getName(), originalDeclaration.getType(), make.Literal(null));
StatementTree assignment = make.ExpressionStatement(make.Assignment(make.Identifier(originalDeclaration.getName()), originalDeclaration.getInitializer()));
List<StatementTree> finallyStatements = new ArrayList<StatementTree>(tt.getFinallyBlock() != null ? tt.getFinallyBlock().getStatements() : Collections.<StatementTree>emptyList());
finallyStatements.add(createFinallyCloseBlockStatement(originalDeclaration));
BlockTree finallyTree = make.Block(finallyStatements, false);
info.rewrite(originalDeclaration, assignment);
TryTree nueTry = make.Try(tt.getResources(), tt.getBlock(), catches, finallyTree);
TreePath currentBlockCandidate = statement;
while (currentBlockCandidate.getLeaf() != tt) {
currentBlockCandidate = currentBlockCandidate.getParentPath();
}
currentBlockCandidate = currentBlockCandidate.getParentPath();
if (currentBlockCandidate.getLeaf().getKind() == Kind.BLOCK) {
BlockTree originalTree = (BlockTree) currentBlockCandidate.getLeaf();
List<StatementTree> statements = new ArrayList<StatementTree>(originalTree.getStatements());
int index = statements.indexOf(tt);
statements.remove(index);
statements.add(index, nueTry);
statements.add(index, declaration);
info.rewrite(originalTree, make.Block(statements, originalTree.isStatic()));
} else {
BlockTree nueBlock = make.Block(Arrays.asList(declaration, nueTry), false);
info.rewrite(tt, nueBlock);
}
}
return null;
}