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


Java List.set方法代码示例

本文整理汇总了Java中java.util.List.set方法的典型用法代码示例。如果您正苦于以下问题:Java List.set方法的具体用法?Java List.set怎么用?Java List.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.List的用法示例。


在下文中一共展示了List.set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: swapMoveAdd

import java.util.List; //导入方法依赖的package包/类
private void swapMoveAdd(List<UpdateOp> list, int move, UpdateOp moveOp, int add, UpdateOp addOp) {
    int offset = 0;
    if (moveOp.itemCount < addOp.positionStart) {
        offset = 0 - 1;
    }
    if (moveOp.positionStart < addOp.positionStart) {
        offset++;
    }
    if (addOp.positionStart <= moveOp.positionStart) {
        moveOp.positionStart += addOp.itemCount;
    }
    if (addOp.positionStart <= moveOp.itemCount) {
        moveOp.itemCount += addOp.itemCount;
    }
    addOp.positionStart += offset;
    list.set(move, addOp);
    list.set(add, moveOp);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:19,代码来源:OpReorderer.java

示例2: updateFeedMetaDataAt

import java.util.List; //导入方法依赖的package包/类
@SuppressWarnings({"ResultOfMethodCallIgnored", "ConstantConditions"})
public static void updateFeedMetaDataAt(final Context context, final int position,
                                        final List<String> metaData) {
    final LinkedListMultimap<String, String> map = getFeedMetaData(context);

    final String currentTitle = getFeedMetaDataTitleAt(context, position);
    final String newTitle = metaData.get(TITLE);
    final String category = metaData.get(FEED_ID);

    final List<String> values = new ArrayList<>(map.removeAll(currentTitle));
    values.set(CATEGORY, category);

    map.putAll(newTitle, values);

    putFeedMetaData(context, map);
    updateCurrentFeedAdapterPosition(context, newTitle);
}
 
开发者ID:Applications-Development,项目名称:SimpleRssReader,代码行数:18,代码来源:SharedPrefUtils.java

示例3: getResultList

import java.util.List; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected List getResultList(List results, ResultTransformer resultTransformer) throws QueryException {
	// meant to handle dynamic instantiation queries...
	HolderInstantiator holderInstantiator = buildHolderInstantiator( resultTransformer );
	if ( holderInstantiator.isRequired() ) {
		for ( int i = 0; i < results.size(); i++ ) {
			Object[] row = ( Object[] ) results.get( i );
			Object result = holderInstantiator.instantiate(row);
			results.set( i, result );
		}

		if ( !hasSelectNew() && resultTransformer != null ) {
			return resultTransformer.transformList(results);
		}
		else {
			return results;
		}
	}
	else {
		return results;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:QueryLoader.java

示例4: createFullYear

import java.util.List; //导入方法依赖的package包/类
private List<MonthlyPvDatum> createFullYear(int year, List<MonthlyPvDatum> monthPvData) {
    List<MonthlyPvDatum> fullYear = new ArrayList<>();
    for (int month = 1; month <= 12; month++) {
        fullYear.add(new MonthlyPvDatum(year, month, 0));
    }
    for (MonthlyPvDatum monthlyPvDatum : monthPvData) {
        int fullYearIndex = monthlyPvDatum.getMonth() - 1;
        fullYear.set(fullYearIndex, monthlyPvDatum);
    }
    return fullYear;
}
 
开发者ID:jansipke,项目名称:pvdisplay,代码行数:12,代码来源:MonthlyFragment.java

示例5: resolveResourceIds

import java.util.List; //导入方法依赖的package包/类
public static void resolveResourceIds(final Activity activity, final List<Integer> idRes) {
    final TypedValue tv = new TypedValue();
    final Resources.Theme theme = activity.getTheme();

    int i = 0;

    for (final int res : idRes) {
        theme.resolveAttribute(res, tv, true);
        idRes.set(i, tv.resourceId);
        i++;
    }
}
 
开发者ID:Applications-Development,项目名称:SimpleRssReader,代码行数:13,代码来源:TypedValueUtils.java

示例6: trimGaps

import java.util.List; //导入方法依赖的package包/类
/**
 * Remove only deletion/NNNs from the beginning and the end of alignment
 *
 * @param sequence
 * @param firstAA
 * @param lastAA
 * @param mutations
 * @param frameShifts
 * @return
 */
private static int[] trimGaps(
		Sequence sequence, int firstAA, int lastAA,
		Collection<Mutation> mutations, Collection<FrameShift> frameShifts) {
	int trimLeft = 0;
	int trimRight = 0;
	int proteinSize = lastAA - firstAA + 1;
	List<Boolean> gapSites = new ArrayList<>(Collections.nCopies(proteinSize, false));
	for (Mutation mut : mutations) {
		int idx = mut.getPosition() - firstAA;
		if (mut.isDeletion() || mut.isUnsequenced()) {
			gapSites.set(idx, true);
		}
	}
	// remove initial deletions
	for (int idx=0; idx < proteinSize; idx ++) {
		if (!gapSites.get(idx)) {
			if (idx > trimLeft) {
				trimLeft = idx;
			}
			break;
		}
	}
	// remove trailing deletions
	for (int idx=proteinSize-1; idx > -1; idx --) {
		if (!gapSites.get(idx)) {
			if (proteinSize - idx - 1 > trimRight) {
				trimRight = proteinSize - idx - 1;
			}
			break;
		}
	}
	return new int[]{trimLeft, trimRight};
}
 
开发者ID:hivdb,项目名称:sierra,代码行数:44,代码来源:NucAminoAligner.java

示例7: getProcessBuilder

import java.util.List; //导入方法依赖的package包/类
public static ProcessBuilder getProcessBuilder(String paths, List<String> command) throws IOException {
	if (command == null || command.size() == 0) {
		throw new IOException("No command paramater");
	}
	
	paths = getAllPaths(paths);
	command.set(0, searchFullPath(paths, command.get(0)));
	ProcessBuilder pb = new ProcessBuilder(command);
	Map<String, String> pbEnv = pb.environment();		
	// must set "Path" for Windows 8.1 64
	pbEnv.put(pbEnv.get("PATH") == null ? "Path" : "PATH", paths);
	return pb; 
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:14,代码来源:ProcessUtils.java

示例8: setEntanglementStack

import java.util.List; //导入方法依赖的package包/类
default void setEntanglementStack(UUID uuid, ItemStack stack, int slot) {
	List<ItemStack> list = getEntanglement(uuid);
	if(!hasSlot(uuid, slot)) {
		if(!stack.isEmpty()) {
			list.add(stack);
		}
	} else if(!stack.isEmpty()) {
		list.set(slot, stack);
	} else {
		list.remove(slot);
	}
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:13,代码来源:IQuantumData.java

示例9: testReturnCanBeSet

import java.util.List; //导入方法依赖的package包/类
/***/
@Test
public void testReturnCanBeSet() {
	final List<String> ret = transform(new Object[] { "item" }, input -> valueOf(input));
	assertFalse(ret.isEmpty());
	assertTrue("item".equals(getOnlyElement(ret)));
	ret.set(0, "another item");
	assertTrue("another item".equals(getOnlyElement(ret)));
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:10,代码来源:Arrays2Test.java

示例10: main

import java.util.List; //导入方法依赖的package包/类
public static void main(String[] args) {
    List<Integer> list = new ArrayList<>();
    Integer[] arr = {2,10,3};
    list = Arrays.asList(arr);
    list.set(0, 3);
    System.out.println(list);
    list.add(1);
    System.out.println(list);
}
 
开发者ID:yohlulz,项目名称:MLE5109-Course-samples,代码行数:10,代码来源:ListPuzzle.java

示例11: sequencingOfSchemaFieldsInOrderOfInternalSchemaFields

import java.util.List; //导入方法依赖的package包/类
private void sequencingOfSchemaFieldsInOrderOfInternalSchemaFields(List<GridRow> outputSchema,
		List<GridRow> internalSchema2) {
	for(int index=0;index<internalSchema2.size();index++){
		if(!StringUtils.equalsIgnoreCase(outputSchema.get(index).getFieldName(), internalSchema2.get(index).getFieldName())){
			outputSchema.set(index,internalSchema2.get(index));
		}
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:9,代码来源:ELTSchemaGridWidget.java

示例12: testAsList_toArray_roundTrip

import java.util.List; //导入方法依赖的package包/类
public void testAsList_toArray_roundTrip() {
  char[] array = { (char) 0, (char) 1, (char) 2 };
  List<Character> list = Chars.asList(array);
  char[] newArray = Chars.toArray(list);

  // Make sure it returned a copy
  list.set(0, (char) 4);
  assertTrue(Arrays.equals(
      new char[] { (char) 0, (char) 1, (char) 2 }, newArray));
  newArray[1] = (char) 5;
  assertEquals((char) 1, (char) list.get(1));
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:13,代码来源:CharsTest.java

示例13: addResultsToList

import java.util.List; //导入方法依赖的package包/类
private void addResultsToList(List<StatusOrException> sliceStatuses) {
    for (AtomicArray.Entry<Tuple<BulkByScrollResponse, Exception>> t : results.asList()) {
        if (t.value != null) {
            if (t.value.v1() != null) {
                sliceStatuses.set(t.index, new StatusOrException(t.value.v1().getStatus()));
            } else {
                sliceStatuses.set(t.index, new StatusOrException(t.value.v2()));
            }
        }
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:12,代码来源:ParentBulkByScrollTask.java

示例14: removeSelf

import java.util.List; //导入方法依赖的package包/类
@Override
public boolean removeSelf() {
    IRNode header = getChildren().get(DoWhilePart.HEADER.ordinal());
    List<IRNode> siblings = getParent().getChildren();
    int index = siblings.indexOf(this);
    siblings.set(index++, loop.initialization);
    if (header instanceof Block) {
        siblings.addAll(index, header.getChildren());
    } else {
        siblings.add(index, header);
    }
    return true;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:DoWhile.java

示例15: answersModification_setByMutator_collectionShouldBeCopied

import java.util.List; //导入方法依赖的package包/类
@Test
public void answersModification_setByMutator_collectionShouldBeCopied() {
    // given
    GeneralVariables gv = new GeneralVariables();
    List<String> answers = Lists.newArrayList("a");
    gv.setAnswers(answers);

    // when
    answers.set(0, "b");

    // then
    assertThat(gv.getAnswers().get(0)).isEqualTo("a");

}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:15,代码来源:GeneralVariablesJUnitTest.java


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