当前位置: 首页>>代码示例>>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;未经允许,请勿转载。