當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。