当前位置: 首页>>代码示例>>Java>>正文


Java List.remove方法代码示例

本文整理汇总了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;
}
 
开发者ID:intuit,项目名称:karate,代码行数:25,代码来源:Script.java

示例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++;
        }
    }
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:18,代码来源:VirtualMachineScaleSetImpl.java

示例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);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:HttpPipelineConnection.java

示例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)));
	}
}
 
开发者ID:syndesisio,项目名称:syndesis-qe,代码行数:17,代码来源:IntegrationSteps.java

示例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;
    }
 
开发者ID:riteshakya037,项目名称:Android-Scrapper,代码行数:27,代码来源:LeagueBase.java

示例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);
  }
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:17,代码来源:ListMultimapRemoveTester.java

示例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();
    }
 
开发者ID:Axway,项目名称:ats-framework,代码行数:15,代码来源:Test_MetaData.java

示例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; 
}
 
开发者ID:ferenc-hechler,项目名称:RollenspielAlexaSkill,代码行数:14,代码来源:SoloRoleplayGame.java

示例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;
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:11,代码来源:CPOther.java

示例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;
	}
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:9,代码来源:SystemTime.java

示例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;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:26,代码来源:FileUtils.java

示例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);
            }
        }
    }
}
 
开发者ID:XndroidDev,项目名称:Xndroid,代码行数:11,代码来源:HorizontalItemAnimator.java

示例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!");
	}
}
 
开发者ID:StreamerSpectrum,项目名称:BeamTeamDiscordBot,代码行数:67,代码来源:FollowReport.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:49,代码来源:MagicSurroundWithTryCatchFix.java


注:本文中的java.util.List.remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。