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


Java ListIterator.set方法代碼示例

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


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

示例1: toMap

import java.util.ListIterator; //導入方法依賴的package包/類
@Exclude
// on map l'univers
public Map<String, Object> toMap() {
    HashMap<String, Object> result = new HashMap<>();
    result.put("Id", id);
    result.put("Name", name);
    ListIterator iterator = universeUserList.listIterator();
    // on appel la fonction de mapping des contacts
    while(iterator.hasNext()){

        Contact contact= (Contact)iterator.next();
        HashMap<String,Object> contacthashed= contact.toMap();
        iterator.previous();
        iterator.set(contacthashed);
        iterator.next();
    }
    result.put("UniverseUserList", universeUserList);
    // celle de mapping des MOI
    if (MOIList!=null){
        MoiListtoMap();
   }
    else MOIList =  new ArrayList<MOI>();
    result.put("MOIList", MOIList);

    return result;
}
 
開發者ID:jkobject,項目名稱:PiPle,代碼行數:27,代碼來源:Universe.java

示例2: mapChildrenDeep

import java.util.ListIterator; //導入方法依賴的package包/類
@NonNull
@Override
public B mapChildrenDeep(@NonNull final Function<BuildableComponent<? ,?>, BuildableComponent<? ,?>> function) {
  if(this.children == EMPTY_COMPONENT_LIST) {
    return (B) this;
  }
  final ListIterator<Component> it = this.children.listIterator();
  while(it.hasNext()) {
    final Component child = it.next();
    if(!(child instanceof BuildableComponent)) {
      continue;
    }
    final BuildableComponent mappedChild = function.apply((BuildableComponent) child);
    if(mappedChild.children().isEmpty()) {
      if(child == mappedChild) {
        continue;
      }
      it.set(mappedChild);
    } else {
      final Builder<?, ?> builder = mappedChild.toBuilder();
      builder.mapChildrenDeep(function);
      it.set(builder.build());
    }
  }
  return (B) this;
}
 
開發者ID:KyoriPowered,項目名稱:text,代碼行數:27,代碼來源:AbstractBuildableComponent.java

示例3: replaceValues

import java.util.ListIterator; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 *
 * <p>If any entries for the specified {@code key} already exist in the
 * multimap, their values are changed in-place without affecting the iteration
 * order.
 *
 * <p>The returned list is immutable and implements
 * {@link java.util.RandomAccess}.
 */
@Override
public List<V> replaceValues(@Nullable K key, Iterable<? extends V> values) {
  List<V> oldValues = getCopy(key);
  ListIterator<V> keyValues = new ValueForKeyIterator(key);
  Iterator<? extends V> newValues = values.iterator();

  // Replace existing values, if any.
  while (keyValues.hasNext() && newValues.hasNext()) {
    keyValues.next();
    keyValues.set(newValues.next());
  }

  // Remove remaining old values, if any.
  while (keyValues.hasNext()) {
    keyValues.next();
    keyValues.remove();
  }

  // Add remaining new values, if any.
  while (newValues.hasNext()) {
    keyValues.add(newValues.next());
  }

  return oldValues;
}
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:36,代碼來源:LinkedListMultimap.java

示例4: toMap

import java.util.ListIterator; //導入方法依賴的package包/類
/***
 *
 * convert the object into a map and al its children
 *
 * @return the map
 */
public HashMap<String, Object> toMap() {
    HashMap<String, Object> result = new HashMap<>();
    result.put("mMessage", mmessage);
    result.put("IdUser", iduser);
    result.put("IdMessage", idmessage);
    if(children!=null){
    ListIterator iterator = children.listIterator();
    while(iterator.hasNext()){

        Message child= (Message) iterator.next();
        HashMap<String,Object> contacthashed= child.toMap();
        iterator.previous();
        iterator.set(contacthashed);
        iterator.next();
    }}
    result.put("Children", children);
    return result;
}
 
開發者ID:jkobject,項目名稱:PiPle,代碼行數:25,代碼來源:Message.java

示例5: clone

import java.util.ListIterator; //導入方法依賴的package包/類
@Override
@SuppressWarnings("unchecked") // Safe casts assuming clone() works correctly
public Object clone() {
    try {
        ReverseState clonedState = (ReverseState) super.clone();

        /* clone checkers, if cloneable */
        clonedState.userCheckers =
                    (ArrayList<PKIXCertPathChecker>)userCheckers.clone();
        ListIterator<PKIXCertPathChecker> li =
                    clonedState.userCheckers.listIterator();
        while (li.hasNext()) {
            PKIXCertPathChecker checker = li.next();
            if (checker instanceof Cloneable) {
                li.set((PKIXCertPathChecker)checker.clone());
            }
        }

        /* make copy of name constraints */
        if (nc != null) {
            clonedState.nc = (NameConstraintsExtension) nc.clone();
        }

        /* make copy of policy tree */
        if (rootNode != null) {
            clonedState.rootNode = rootNode.copyTree();
        }

        return clonedState;
    } catch (CloneNotSupportedException e) {
        throw new InternalError(e.toString(), e);
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:34,代碼來源:ReverseState.java

示例6: mergeContinueNumIntoOne

import java.util.ListIterator; //導入方法依賴的package包/類
/**
 * 將連續的數字節點合並為一個
 * 
 * @param linkedArray
 */
private static void mergeContinueNumIntoOne(List<Vertex> linkedArray) {
	if (linkedArray.size() < 2)
		return;

	ListIterator<Vertex> listIterator = linkedArray.listIterator();
	Vertex next = listIterator.next();
	Vertex current = next;
	while (listIterator.hasNext()) {
		next = listIterator.next();
		// System.out.println("current:" + current + " next:" + next);
		if ((TextUtility.isAllNum(current.realWord) || TextUtility
				.isAllChineseNum(current.realWord))
				&& (TextUtility.isAllNum(next.realWord) || TextUtility
						.isAllChineseNum(next.realWord))) {
			// ///////// 這部分從邏輯上等同於current.realWord = current.realWord +
			// next.realWord;
			// 但是current指針被幾個路徑共享,需要備份,不然修改了一處就修改了全局
			current = Vertex.newNumberInstance(current.realWord
					+ next.realWord);
			listIterator.previous();
			listIterator.previous();
			listIterator.set(current);
			listIterator.next();
			listIterator.next();
			// ///////// end 這部分
			// System.out.println("before:" + linkedArray);
			listIterator.remove();
			// System.out.println("after:" + linkedArray);
		} else {
			current = next;
		}
	}

	// logger.trace("數字識別後:" + Graph.parseResult(linkedArray));
}
 
開發者ID:priester,項目名稱:hanlpStudy,代碼行數:41,代碼來源:WordBasedGenerativeModelSegment.java

示例7: replaceAll

import java.util.ListIterator; //導入方法依賴的package包/類
/**
 * Visits the statements in the specified mutable list. If a statement's
 * visit method calls replaceVisitedMethodWith(), the statement will be
 * replaced.
 */
@SuppressWarnings("unchecked")
protected <T extends Statement> void replaceAll(List<T> stats) {
  ListIterator<T> iter = stats.listIterator();
    while (iter.hasNext()) {
        iter.set((T) replace(iter.next()));
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:13,代碼來源:StatementReplacingVisitorSupport.java

示例8: process

import java.util.ListIterator; //導入方法依賴的package包/類
public void process(HttpRequest httpRequest, HttpContext httpContext) throws HttpException, IOException {
    final HttpClientContext clientContext = HttpClientContext.adapt(httpContext);
    List<Cookie> cookies = clientContext.getCookieStore().getCookies();
    boolean set = (null != StickyCookieHolder.getTestStickySessionCookie());
    boolean found = false;
    ListIterator<Cookie> it = cookies.listIterator();
    while (it.hasNext()) {
        Cookie cookie = it.next();
        if (cookie.getName().equals(StickyCookieHolder.COOKIE_NAME)) {
            found = true;
            if (set) {
                // set the cookie with the value saved for each thread using the rule
                it.set(StickyCookieHolder.getTestStickySessionCookie());
            } else {
                // if the cookie is not set in TestStickySessionRule, remove it from here
                it.remove();
            }
        }
    }
    // if the cookie needs to be set from TestStickySessionRule but did not exist in the client cookie list, add it here.
    if (!found && set) {
        cookies.add(StickyCookieHolder.getTestStickySessionCookie());
    }
    BasicCookieStore cs = new BasicCookieStore();
    cs.addCookies(cookies.toArray(new Cookie[cookies.size()]));
    httpContext.setAttribute(HttpClientContext.COOKIE_STORE, cs);
}
 
開發者ID:apache,項目名稱:sling-org-apache-sling-testing-clients,代碼行數:28,代碼來源:StickyCookieInterceptor.java

示例9: testSet

import java.util.ListIterator; //導入方法依賴的package包/類
/**
 * Test of set method, of class TreeListIterator.
 */
@Test(expected = UnsupportedOperationException.class)
public void testSet() {
    ListIterator<TreeNode> treeListIterator2 = new TreeListIterator(tree2);
    treeListIterator2.next();
    treeListIterator2.set(null);
}
 
開發者ID:miyagilabs,項目名稱:Blindfold,代碼行數:10,代碼來源:TreeListIteratorTest.java

示例10: testSet

import java.util.ListIterator; //導入方法依賴的package包/類
public void testSet() {
  ListIterator<String> iterator = create();

  assertTrue(iterator.hasNext());
  assertEquals("a", iterator.next());
  assertEquals("b", iterator.next());
  assertEquals("b", iterator.previous());
  try {
    iterator.set("c");
    fail();
  } catch (UnsupportedOperationException expected) {}
}
 
開發者ID:zugzug90,項目名稱:guava-mock,代碼行數:13,代碼來源:UnmodifiableListIteratorTest.java

示例11: listenerShouldGetAdded

import java.util.ListIterator; //導入方法依賴的package包/類
private boolean listenerShouldGetAdded(T listener) {
	if ( listeners == null ) {
		listeners = new ArrayList<T>();
		return true;
		// no need to do de-dup checks
	}

	boolean doAdd = true;
	strategy_loop: for ( DuplicationStrategy strategy : duplicationStrategies ) {
		final ListIterator<T> itr = listeners.listIterator();
		while ( itr.hasNext() ) {
			final T existingListener = itr.next();
			if ( strategy.areMatch( listener,  existingListener ) ) {
				switch ( strategy.getAction() ) {
					// todo : add debug logging of what happens here...
					case ERROR: {
						throw new EventListenerRegistrationException( "Duplicate event listener found" );
					}
					case KEEP_ORIGINAL: {
						doAdd = false;
						break strategy_loop;
					}
					case REPLACE_ORIGINAL: {
						itr.set( listener );
						doAdd = false;
						break strategy_loop;
					}
				}
			}
		}
	}
	return doAdd;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:34,代碼來源:EventListenerGroupImpl.java

示例12: testListIteratorSetListFail

import java.util.ListIterator; //導入方法依賴的package包/類
@Test(expected = IllegalStateException.class)
public void testListIteratorSetListFail() {
    List<Integer> list = new ArrayList<Integer>();
    list.add(1);

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

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

示例13: testListIteratorSetFail

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

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

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

示例14: SplitMiddleSlashFromDigitalWords

import java.util.ListIterator; //導入方法依賴的package包/類
private static void SplitMiddleSlashFromDigitalWords(
		List<Vertex> linkedArray) {
	if (linkedArray.size() < 2)
		return;

	ListIterator<Vertex> listIterator = linkedArray.listIterator();
	Vertex next = listIterator.next();
	Vertex current = next;
	while (listIterator.hasNext()) {
		next = listIterator.next();
		// System.out.println("current:" + current + " next:" + next);
		Nature currentNature = current.getNature();
		if (currentNature == Nature.nx
				&& (next.hasNature(Nature.q) || next.hasNature(Nature.n))) {
			String[] param = current.realWord.split("-", 1);
			if (param.length == 2) {
				if (TextUtility.isAllNum(param[0])
						&& TextUtility.isAllNum(param[1])) {
					current = current.copy();
					current.realWord = param[0];
					current.confirmNature(Nature.m);
					listIterator.previous();
					listIterator.previous();
					listIterator.set(current);
					listIterator.next();
					listIterator.add(Vertex.newPunctuationInstance("-"));
					listIterator.add(Vertex.newNumberInstance(param[1]));
				}
			}
		}
		current = next;
	}

	// logger.trace("杠號識別後:" + Graph.parseResult(linkedArray));
}
 
開發者ID:priester,項目名稱:hanlpStudy,代碼行數:36,代碼來源:WordBasedGenerativeModelSegment.java

示例15: checkElementAndConvert

import java.util.ListIterator; //導入方法依賴的package包/類
/**
 * Only document can be select
 * See: https://github.com/code4craft/webmagic/issues/113
 *
 * @param elementIterator elementIterator
 * @return element element
 */
private Element checkElementAndConvert(ListIterator<Element> elementIterator) {
    Element element = elementIterator.next();
    if (!(element instanceof Document)) {
        Document root = new Document(element.ownerDocument().baseUri());
        Element clone = element.clone();
        root.appendChild(clone);
        elementIterator.set(root);
        return root;
    }
    return element;
}
 
開發者ID:fengzhizi715,項目名稱:NetDiscovery,代碼行數:19,代碼來源:HtmlNode.java


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