當前位置: 首頁>>代碼示例>>Java>>正文


Java List.listIterator方法代碼示例

本文整理匯總了Java中java.util.List.listIterator方法的典型用法代碼示例。如果您正苦於以下問題:Java List.listIterator方法的具體用法?Java List.listIterator怎麽用?Java List.listIterator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.List的用法示例。


在下文中一共展示了List.listIterator方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: protectIntentFilter

import java.util.List; //導入方法依賴的package包/類
public static void protectIntentFilter(IntentFilter filter) {
    if (filter != null) {
        List<String> actions = mirror.android.content.IntentFilter.mActions.get(filter);
        ListIterator<String> iterator = actions.listIterator();
        while (iterator.hasNext()) {
            String action = iterator.next();
            if (SpecialComponentList.isActionInBlackList(action)) {
                iterator.remove();
                continue;
            }
            if (SYSTEM_BROADCAST_ACTION.contains(action)) {
                continue;
            }
            String newAction = SpecialComponentList.protectAction(action);
            if (newAction != null) {
                iterator.set(newAction);
            }
        }
    }
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:21,代碼來源:SpecialComponentList.java

示例2: resolveConflicts

import java.util.List; //導入方法依賴的package包/類
public List<Versioned<T>> resolveConflicts(List<Versioned<T>> items) {
    int size = items.size();
    if(size <= 1)
        return items;

    List<Versioned<T>> newItems = Lists.newArrayList();
    for(Versioned<T> v1: items) {
        boolean found = false;
        for(ListIterator<Versioned<T>> it2 =
                newItems.listIterator(); it2.hasNext();) {
            Versioned<T> v2 = it2.next();
            Occurred compare = v1.getVersion().compare(v2.getVersion());
            if(compare == Occurred.AFTER) {
                if(found)
                    it2.remove();
                else
                    it2.set(v1);
            }
            if(compare != Occurred.CONCURRENTLY)
                found = true;
        }
        if(!found)
            newItems.add(v1);
    }
    return newItems;
}
 
開發者ID:nsg-ethz,項目名稱:iTAP-controller,代碼行數:27,代碼來源:VectorClockInconsistencyResolver.java

示例3: testListIteratorGetSet

import java.util.List; //導入方法依賴的package包/類
@Test
public void testListIteratorGetSet() {
    List<Integer> list = redisson.getList("list");
    list.add(1);
    list.add(2);
    list.add(3);
    list.add(4);

    ListIterator<Integer> iterator = list.listIterator();

    Assert.assertFalse(iterator.hasPrevious());
    Assert.assertTrue(1 == iterator.next());
    iterator.set(3);
    assertThat(list).containsExactly(3, 2, 3, 4);
    Assert.assertTrue(2 == iterator.next());
    iterator.add(31);
    assertThat(list).containsExactly(3, 2, 31, 3, 4);
    Assert.assertTrue(3 == iterator.next());
    Assert.assertTrue(4 == iterator.next());
    Assert.assertFalse(iterator.hasNext());
    iterator.add(71);
    assertThat(list).containsExactly(3, 2, 31, 3, 4, 71);
    iterator.add(8);
    assertThat(list).containsExactly(3, 2, 31, 3, 4, 71, 8);
}
 
開發者ID:qq1588518,項目名稱:JRediClients,代碼行數:26,代碼來源:RedissonListTest.java

示例4: unmarkAndUnloadProjects

import java.util.List; //導入方法依賴的package包/類
/**
 * Remove the given marked project from every loaded project that it depends on and unload those projects which have
 * no marks anymore, since those are no longer required to process other projects.
 *
 * @param loadedProjects
 *            the currently loaded projects
 * @param markedProject
 *            the project that was just processed
 * @param resourceSet
 *            the resource set
 * @param recorder
 *            the progress recorder
 */
private void unmarkAndUnloadProjects(List<MarkedProject> loadedProjects, MarkedProject markedProject,
		ResourceSet resourceSet, N4ProgressStateRecorder recorder) {
	ListIterator<MarkedProject> loadedIter = loadedProjects.listIterator();
	while (loadedIter.hasNext()) {
		MarkedProject loaded = loadedIter.next();
		loaded.remove(markedProject.project);

		if (!loaded.hasMarkers()) {
			if (logger.isCreateDebugOutput()) {
				logger.debug("Unloading project " + loaded.project);
			}

			loaded.unload(resourceSet, recorder);
			loadedIter.remove();
		}
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:31,代碼來源:N4HeadlessCompiler.java

示例5: getNextCategory

import java.util.List; //導入方法依賴的package包/類
private String getNextCategory(String category, int dir) {
    if (dir>0) dir = 1;
    if (dir<0) dir = -1;

    List<String> categories = db().getCategories();
    for (ListIterator<String> it = categories.listIterator(); it.hasNext();) {
        String cat = it.next();
        if (Categories.isHiddenCategory(cat)) it.remove();
    }
    int last = categories.size() -1;
    for (int i=0; i<categories.size(); i++) {
        if (categories.get(i).equals(category)) {
            if (i==0 && dir==-1) return categories.get(last);
            if (i==last && dir==1) return categories.get(0);
            return categories.get(i+dir);
        }
    }
    return null;
}
 
開發者ID:quaap,項目名稱:LaunchTime,代碼行數:20,代碼來源:MainActivity.java

示例6: seg2sentence

import java.util.List; //導入方法依賴的package包/類
/**
 * 切分為句子形式
 *
 * @param text
 * @param filterArrayChain 自定義過濾器鏈
 * @return
 */
public static List<List<Term>> seg2sentence(String text, Filter... filterArrayChain)
{
    List<List<Term>> sentenceList = SEGMENT.seg2sentence(text);
    for (List<Term> sentence : sentenceList)
    {
        ListIterator<Term> listIterator = sentence.listIterator();
        while (listIterator.hasNext())
        {
            if (filterArrayChain != null)
            {
                Term term = listIterator.next();
                for (Filter filter : filterArrayChain)
                {
                    if (!filter.shouldInclude(term))
                    {
                        listIterator.remove();
                        break;
                    }
                }
            }
        }
    }

    return sentenceList;
}
 
開發者ID:priester,項目名稱:hanlpStudy,代碼行數:33,代碼來源:NotionalTokenizer.java

示例7: equals

import java.util.List; //導入方法依賴的package包/類
@Override
public boolean equals(final Object obj) {
    if (obj == this) {
        return true;
    }
    if (obj instanceof List == false) {
        return false;
    }
    final List<?> other = (List<?>) obj;
    if (other.size() != size()) {
        return false;
    }
    final ListIterator<?> it1 = listIterator();
    final ListIterator<?> it2 = other.listIterator();
    while (it1.hasNext() && it2.hasNext()) {
        final Object o1 = it1.next();
        final Object o2 = it2.next();
        if (!(o1 == null ? o2 == null : o1.equals(o2))) {
            return false;
        }
    }
    return !(it1.hasNext() || it2.hasNext());
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:24,代碼來源:AbstractLinkedList.java

示例8: PermutationIterator

import java.util.List; //導入方法依賴的package包/類
public PermutationIterator(List<T> toPermute) {
    ListIterator<T> iter = toPermute.listIterator();
    if (iter.hasNext())
        head = new DirInt(iter.nextIndex(), iter.next());
    DirInt prev = head;
    while (iter.hasNext()) {
        DirInt di = new DirInt(iter.nextIndex(), iter.next());
        di.left = prev;
        prev.right = di;
        prev = di;
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:13,代碼來源:XPreferTest.java

示例9: apply

import java.util.List; //導入方法依賴的package包/類
/**
 * 對分詞結果應用過濾
 * @param termList
 */
public static void apply(List<Term> termList)
{
    ListIterator<Term> listIterator = termList.listIterator();
    while (listIterator.hasNext())
    {
        if (shouldRemove(listIterator.next())) listIterator.remove();
    }
}
 
開發者ID:priester,項目名稱:hanlpStudy,代碼行數:13,代碼來源:CoreStopWordDictionary.java

示例10: FallbackJSBundleLoader

import java.util.List; //導入方法依賴的package包/類
/**
 * @param loaders Loaders for the sources to try, in descending order of
 *                preference.
 */
public FallbackJSBundleLoader(List<JSBundleLoader> loaders) {
  mLoaders = new Stack();
  ListIterator<JSBundleLoader> it = loaders.listIterator(loaders.size());
  while (it.hasPrevious()) {
    mLoaders.push(it.previous());
  }
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:12,代碼來源:FallbackJSBundleLoader.java

示例11: indexOfImpl

import java.util.List; //導入方法依賴的package包/類
/**
 * An implementation of {@link List#indexOf(Object)}.
 */
static int indexOfImpl(List<?> list, @Nullable Object element) {
  ListIterator<?> listIterator = list.listIterator();
  while (listIterator.hasNext()) {
    if (Objects.equal(element, listIterator.next())) {
      return listIterator.previousIndex();
    }
  }
  return -1;
}
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:13,代碼來源:Lists.java

示例12: testUnmodListIteratorSet

import java.util.List; //導入方法依賴的package包/類
@Test(dataProvider = "unsettable",
      expectedExceptions = UnsupportedOperationException.class)
public void testUnmodListIteratorSet(List<Integer> list, int from, int to) {
    List<Integer> subList = list.subList(from, to);
    ListIterator<Integer> it = subList.listIterator();
    it.next();
    it.set(42);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:9,代碼來源:SubList.java

示例13: executeAction

import java.util.List; //導入方法依賴的package包/類
@Override
public void executeAction(String superProcessInstanceId) {
    List<String> subProcessIds = getActiveExecutionIds(superProcessInstanceId);
    ListIterator<String> subProcessesIdsIterator = subProcessIds.listIterator(subProcessIds.size());
    while (subProcessesIdsIterator.hasPrevious()) {
        String subProcessId = subProcessesIdsIterator.previous();
        retryProcess(subProcessId);
    }
}
 
開發者ID:SAP,項目名稱:cf-mta-deploy-service,代碼行數:10,代碼來源:RetryActivitiAction.java

示例14: visitImpl

import java.util.List; //導入方法依賴的package包/類
@Override
protected KeyValuePair<K, V> visitImpl(Map<K, V> map, boolean hasExtra, MapOperateInterceptor<K, V> moip,
		IterationInfo info, Object param, MapPredicateVisitor<K, V> predicate, List<KeyValuePair<K, V>> out) {

	final List<KeyValuePair<K, V>> keyValues = map.getKeyValues();
	final ListIterator<KeyValuePair<K, V>> it = keyValues.listIterator();

	KeyValuePair<K, V> pair;
	if (hasExtra) {
		for (; it.hasNext();) {
			pair = it.next();
			if (moip.intercept(map, pair, param, info)) {
				continue;
			}
			if (isTrue(predicate.visit(pair, param))) {
				out.add(pair);
			}
		}
	} else {
		// no extra ops
		for (; it.hasNext();) {
			pair = it.next();
			if (isTrue(predicate.visit(pair, param))) {
				out.add(pair);
			}
		}
	}
	return null;
}
 
開發者ID:LightSun,項目名稱:Visitor,代碼行數:30,代碼來源:MultipleMapIterateState.java

示例15: testListIteratorOK

import java.util.List; //導入方法依賴的package包/類
@Test
public void testListIteratorOK() {
    List<Integer> list = redisson.getList("simpleList");
    list.add(1);

    ListIterator<Integer> iterator = list.listIterator();

    iterator.next();
    iterator.set(3);
    iterator.set(4);
}
 
開發者ID:qq1588518,項目名稱:JRediClients,代碼行數:12,代碼來源:RedissonListTest.java


注:本文中的java.util.List.listIterator方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。