Java Code Examples for java.util.ListIterator

The following are top voted examples for showing how to use java.util.ListIterator. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Lagerta   File: MergeUtil.java   Source Code and License 6 votes vote down vote up
/**
 * merges two collections
 *
 * @param first      result list
 * @param second     merges with first list
 * @param comparator
 */
public static <T> void merge(List<T> first, List<T> second, Comparator<T> comparator) {
    ListIterator<T> firstIter = first.listIterator();
    ListIterator<T> secondIter = second.listIterator();

    T a = getNext(firstIter);
    T b = getNext(secondIter);

    while (a != null && b != null) {
        if (comparator.compare(a, b) > 0) {
            firstIter.previous();
            firstIter.add(b);
            firstIter.next();
            b = getNext(secondIter);
        } else {
            a = getNext(firstIter);
        }
    }

    while (b != null) {
        firstIter.add(b);
        b = getNext(secondIter);
    }
}
 
Example 2
Project: node-boilerpipe   File: TrailingHeadlineToBoilerplateFilter.java   Source Code and License 6 votes vote down vote up
public boolean process(TextDocument doc) throws BoilerpipeProcessingException {
  boolean changes = false;

  List<TextBlock> list = doc.getTextBlocks();

  for (ListIterator<TextBlock> it = list.listIterator(list.size()); it.hasPrevious();) {
    TextBlock tb = it.previous();
    if (tb.isContent()) {
      if (tb.hasLabel(DefaultLabels.HEADING)) {
        tb.setIsContent(false);
        changes = true;
      } else {
        break;
      }
    }
  }

  return changes;
}
 
Example 3
Project: GitHub   File: RangeLayoutHelperFinder.java   Source Code and License 6 votes vote down vote up
@Override
protected Iterable<LayoutHelper> reverse() {
    final ListIterator<LayoutHelper> i = mLayoutHelpers.listIterator(mLayoutHelpers.size());
    return new Iterable<LayoutHelper>() {
        @Override
        public Iterator<LayoutHelper> iterator() {
            return new Iterator<LayoutHelper>() {
                public boolean hasNext() {
                    return i.hasPrevious();
                }

                public LayoutHelper next() {
                    return i.previous();
                }

                public void remove() {
                    i.remove();
                }
            };
        }
    };
}
 
Example 4
Project: s-store   File: Lists.java   Source Code and License 6 votes vote down vote up
/**
 * An implementation of {@link List#subList(int, int)}.
 */
static <E> List<E> subListImpl(
    final List<E> list, int fromIndex, int toIndex) {
  List<E> wrapper;
  if (list instanceof RandomAccess) {
    wrapper = new RandomAccessListWrapper<E>(list) {
      @Override public ListIterator<E> listIterator(int index) {
        return backingList.listIterator(index);
      }

      private static final long serialVersionUID = 0;
    };
  } else {
    wrapper = new AbstractListWrapper<E>(list) {
      @Override public ListIterator<E> listIterator(int index) {
        return backingList.listIterator(index);
      }

      private static final long serialVersionUID = 0;
    };
  }
  return wrapper.subList(fromIndex, toIndex);
}
 
Example 5
Project: ZooKeeper   File: ClientCnxnSocketNIO.java   Source Code and License 6 votes vote down vote up
private Packet findSendablePacket(LinkedList<Packet> outgoingQueue,
                                  boolean clientTunneledAuthenticationInProgress) {
    synchronized (outgoingQueue) {
        if (outgoingQueue.isEmpty()) {
            return null;
        }
        if (outgoingQueue.getFirst().bb != null // If we've already starting sending the first packet, we better finish
            || !clientTunneledAuthenticationInProgress) {
            return outgoingQueue.getFirst();
        }

        // Since client's authentication with server is in progress,
        // send only the null-header packet queued by primeConnection().
        // This packet must be sent so that the SASL authentication process
        // can proceed, but all other packets should wait until
        // SASL authentication completes.
        ListIterator<Packet> iter = outgoingQueue.listIterator();
        while (iter.hasNext()) {
            Packet p = iter.next();
            if (p.requestHeader == null) {
                // We've found the priming-packet. Move it to the beginning of the queue.
                iter.remove();
                outgoingQueue.add(0, p);
                return p;
            } else {
                // Non-priming packet: defer it until later, leaving it in the queue
                // until authentication completes.
                if (LOG.isDebugEnabled()) {
                    LOG.debug("deferring non-priming packet: " + p +
                            "until SASL authentication completes.");
                }
            }
        }
        // no sendable packet found.
        return null;
    }
}
 
Example 6
Project: athena   File: KeyListenerTest.java   Source Code and License 6 votes vote down vote up
/**
 * Checks key values are set correctly.
 */
@Test
public void processKeyWithUsesInList() throws IOException, ParserException {
    YangNode node = manager.getDataModel("src/test/resources/KeyWithUsesInList.yang");

    assertThat((node instanceof YangModule), is(true));
    assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
    YangModule yangNode = (YangModule) node;
    assertThat(yangNode.getName(), is("Test"));

    // Check whether the list is child of module
    YangList yangList = (YangList) yangNode.getChild().getNextSibling();
    assertThat(yangList.getName(), is("valid"));

    ListIterator<String> keyList = yangList.getKeyList().listIterator();
    assertThat(keyList.next(), is("invalid-interval"));
}
 
Example 7
Project: RNLearn_Project1   File: NativeAnimatedNodesManager.java   Source Code and License 6 votes vote down vote up
public void removeAnimatedEventFromView(int viewTag, String eventName, int animatedValueTag) {
  String key = viewTag + eventName;
  if (mEventDrivers.containsKey(key)) {
    List<EventAnimationDriver> driversForKey = mEventDrivers.get(key);
    if (driversForKey.size() == 1) {
      mEventDrivers.remove(viewTag + eventName);
    } else {
      ListIterator<EventAnimationDriver> it = driversForKey.listIterator();
      while (it.hasNext()) {
        if (it.next().mValueNode.mTag == animatedValueTag) {
          it.remove();
          break;
        }
      }
    }
  }
}
 
Example 8
Project: mupdf-android-viewer-nui   File: DocPageView.java   Source Code and License 6 votes vote down vote up
private PageAnnotation getSelectedAnnotation()
{
	if (mAnnotations != null)
	{
		//  iterate in reverse order
		ListIterator<PageAnnotation> li = mAnnotations.listIterator(mAnnotations.size());
		while (li.hasPrevious())
		{
			PageAnnotation annot = li.previous();
			if (annot.isSelected())
			{
				return annot;
			}
		}
	}

	return null;
}
 
Example 9
Project: HCFCore   File: ListIteratorWrapper.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the next element from the iterator.
 *
 * @return the next element from the iterator
 * @throws NoSuchElementException if there are no more elements
 */
public E next() throws NoSuchElementException {
    if (iterator instanceof ListIterator) {
        return iterator.next();
    }

    if (currentIndex < wrappedIteratorIndex) {
        ++currentIndex;
        return list.get(currentIndex - 1);
    }

    final E retval = iterator.next();
    list.add(retval);
    ++currentIndex;
    ++wrappedIteratorIndex;
    removeState = true;
    return retval;
}
 
Example 10
Project: athena   File: KeyListenerTest.java   Source Code and License 6 votes vote down vote up
/**
 * Checks key statement as sub-statement of list.
 */
@Test
public void processListSubStatementKey() throws IOException, ParserException {

    YangNode node = manager.getDataModel("src/test/resources/ListSubStatementKey.yang");

    assertThat((node instanceof YangModule), is(true));

    // Check whether the node type is set properly to module.
    assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));

    // Check whether the module name is set correctly.
    YangModule yangNode = (YangModule) node;
    assertThat(yangNode.getName(), is("Test"));

    // Check whether the list is child of module
    YangList yangList = (YangList) yangNode.getChild();
    assertThat(yangList.getName(), is("valid"));

    ListIterator<String> keyList = yangList.getKeyList().listIterator();
    assertThat(keyList.next(), is("invalid-interval"));
}
 
Example 11
Project: DicomViewer   File: SortedListTools.java   Source Code and License 6 votes vote down vote up
private static <T> int iteratorBinarySearch(final List<? extends Comparable<? super T>> list, final T key, int low, int high)  {
    final ListIterator<? extends Comparable<? super T>> i = list.listIterator();
    int mid, cmp;
    while (low <= high) {
        mid = (low + high) >>> 1;
        cmp = get(i, mid).compareTo(key);

        if (cmp < 0) {
            low = mid + 1;
        } else if (cmp > 0) {
            high = mid - 1;
        } else {
            return mid;
        } // key found
    }
    return -(low + 1);  // key not found
}
 
Example 12
Project: athena   File: PatternRestrictionListenerTest.java   Source Code and License 6 votes vote down vote up
/**
 * Checks valid pattern statement with plus symbol in pattern.
 */
@Test
public void processPatternStatementWithPlus() throws IOException, ParserException {

    YangNode node = manager.getDataModel("src/test/resources/PatternStatementWithPlus.yang");

    assertThat((node instanceof YangModule), is(true));
    assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
    YangModule yangNode = (YangModule) node;
    assertThat(yangNode.getName(), is("Test"));

    ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
    YangLeafList leafListInfo = leafListIterator.next();

    assertThat(leafListInfo.getName(), is("invalid-interval"));
    assertThat(leafListInfo.getDataType().getDataTypeName(), is("string"));
    assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
    YangStringRestriction stringRestriction = (YangStringRestriction) leafListInfo
            .getDataType().getDataTypeExtendedInfo();
    ListIterator<String> patternListIterator = stringRestriction.getPatternRestriction()
            .getPatternList().listIterator();
    assertThat(patternListIterator.next(), is("-[0-9]+|[0-9]+"));
}
 
Example 13
Project: hanlpStudy   File: NotionalTokenizer.java   Source Code and License 6 votes vote down vote up
/**
 * 切分为句子形式
 *
 * @param text
 * @return
 */
public static List<List<Term>> seg2sentence(String text)
{
    List<List<Term>> sentenceList = SEGMENT.seg2sentence(text);
    for (List<Term> sentence : sentenceList)
    {
        ListIterator<Term> listIterator = sentence.listIterator();
        while (listIterator.hasNext())
        {
            if (!CoreStopWordDictionary.shouldInclude(listIterator.next()))
            {
                listIterator.remove();
            }
        }
    }

    return sentenceList;
}
 
Example 14
Project: athena   File: PatternRestrictionListenerTest.java   Source Code and License 6 votes vote down vote up
/**
 * Checks valid pattern statement as sub-statement of leaf statement.
 */
@Test
public void processValidPatternStatement() throws IOException, ParserException {

    YangNode node = manager.getDataModel("src/test/resources/ValidPatternStatement.yang");

    assertThat((node instanceof YangModule), is(true));
    assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
    YangModule yangNode = (YangModule) node;
    assertThat(yangNode.getName(), is("Test"));

    ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
    YangLeaf leafInfo = leafIterator.next();

    assertThat(leafInfo.getName(), is("invalid-interval"));
    assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
    assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
    YangStringRestriction stringRestriction = (YangStringRestriction) leafInfo
            .getDataType().getDataTypeExtendedInfo();
    ListIterator<String> patternListIterator = stringRestriction.getPatternRestriction()
            .getPatternList().listIterator();
    assertThat(patternListIterator.next(), is("[a-zA-Z]"));
}
 
Example 15
Project: athena   File: DescriptionListenerTest.java   Source Code and License 6 votes vote down vote up
/**
 * Checks valid description statement.
 */
@Test
public void processDescriptionValidStatement() throws IOException, ParserException {

    YangNode node = manager.getDataModel("src/test/resources/DescriptionValidStatement.yang");

    // Check whether the data model tree returned is of type module.
    assertThat((node instanceof YangModule), is(true));

    // Check whether the node type is set properly to module.
    assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));

    // Check whether the module name is set correctly.
    YangModule yangNode = (YangModule) node;
    assertThat(yangNode.getName(), is("Test"));

    ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
    YangLeaf leafInfo = leafIterator.next();

    // Check whether the description is set correctly.
    assertThat(leafInfo.getName(), is("invalid-interval"));
    assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
}
 
Example 16
Project: athena   File: ContainerListenerTest.java   Source Code and License 6 votes vote down vote up
/**
 * Checks container statement as sub-statement of list.
 */
@Test
public void processListSubStatementContainer() throws IOException, ParserException {

    YangNode node = manager.getDataModel("src/test/resources/ListSubStatementContainer.yang");

    assertThat((node instanceof YangModule), is(true));

    // Check whether the node type is set properly to module.
    assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));

    // Check whether the module name is set correctly.
    YangModule yangNode = (YangModule) node;
    assertThat(yangNode.getName(), is("Test"));

    // Check whether the list is child of module
    YangList yangList1 = (YangList) yangNode.getChild();
    assertThat(yangList1.getName(), is("ospf"));

    ListIterator<String> keyList = yangList1.getKeyList().listIterator();
    assertThat(keyList.next(), is("process-id"));

    // Check whether the list is child of list
    YangContainer yangContainer = (YangContainer) yangList1.getChild();
    assertThat(yangContainer.getName(), is("interface"));
}
 
Example 17
Project: Hydrograph   File: HiveFieldDialogHelper.java   Source Code and License 6 votes vote down vote up
/**
 * 
 * Compares available fields and selected partition key fields for 
 *   hive input and output components. 
 * 
 */
public boolean compare_fields(TableItem[] items,List<String> sourceFieldsList)
{
	ListIterator<String> t_itr,s_itr;
	boolean is_equal=true;
	
	List<String> target_fields = new ArrayList<String>();
	if(items.length > 0){
		for (TableItem tableItem : items){
			target_fields.add((String) tableItem.getText());
		}
	
	
	List<String> source_field = new ArrayList<String>(sourceFieldsList);
	
	t_itr=target_fields.listIterator(target_fields.size());
	s_itr = source_field.listIterator(source_field.size());
	
	
	while(t_itr.hasPrevious() & s_itr.hasPrevious()){
		if(StringUtils.equals(s_itr.previous(),t_itr.previous())){
			is_equal=true;
		}
		else{
			is_equal=false;
			break;
		}
	}
	}
	return is_equal;
	
}
 
Example 18
Project: Equella   File: InstitutionImportServiceImpl.java   Source Code and License 6 votes vote down vote up
protected void doErrorCleanup(final TemporaryFileHandle staging, final List<String> tasksDone,
	final Institution institution, final ConverterParams params)
{
	runAs.executeAsSystem(institution, new Runnable()
	{
		@Override
		public void run()
		{
			tasksDone.add(0, ConverterId.CLEANUPFILES.name());
			ListIterator<String> iter = tasksDone.listIterator(tasksDone.size());

			while( iter.hasPrevious() )
			{
				String task = iter.previous();
				getConverter(task).deleteIt(staging, institution, params, task);
			}
			instService.deleteInstitution(institution);
		}
	});
}
 
Example 19
Project: xsharing-services-router   File: AbstractModeStrategy.java   Source Code and License 5 votes vote down vote up
<TUPLE extends StationTuple> ListIterator<TUPLE> getListIterator(List<TUPLE> fromTuples) {
    if (useLiveStatus) {
        return fromTuples.listIterator();
    } else {
        List<TUPLE> out;
        if (fromTuples.isEmpty()) {
            out = Collections.emptyList();
        } else {
            out = fromTuples.subList(0, 1);
        }
        return out.listIterator();
    }
}
 
Example 20
Project: hadoop-oss   File: Configuration.java   Source Code and License 5 votes vote down vote up
private <T> void toString(List<T> resources, StringBuilder sb) {
  ListIterator<T> i = resources.listIterator();
  while (i.hasNext()) {
    if (i.nextIndex() != 0) {
      sb.append(", ");
    }
    sb.append(i.next());
  }
}
 
Example 21
Project: Reer   File: AstUtils.java   Source Code and License 5 votes vote down vote up
public static void filterAndTransformStatements(SourceUnit source, StatementTransformer transformer) {
    ListIterator<Statement> statementIterator = source.getAST().getStatementBlock().getStatements().listIterator();
    while (statementIterator.hasNext()) {
        Statement originalStatement = statementIterator.next();
        Statement transformedStatement = transformer.transform(source, originalStatement);
        if (transformedStatement == null) {
            statementIterator.remove();
        } else if (transformedStatement != originalStatement) {
            statementIterator.set(transformedStatement);
        }
    }
}
 
Example 22
Project: athena   File: BgpFlowSpecNlri.java   Source Code and License 5 votes vote down vote up
/**
 * Update buffer with non-identical flow types.
 *
 * @param cb channel buffer
 */
public static void updateBufferNonIdenticalFlowTypes(ChannelBuffer cb, BgpFlowSpecNlri bgpFlowSpecNlri) {
    ChannelBuffer flowSpecTmpBuff = ChannelBuffers.dynamicBuffer();
    List<BgpValueType> flowSpec = bgpFlowSpecNlri.flowSpecComponents();
    ListIterator<BgpValueType> listIterator = flowSpec.listIterator();
    int tmpBuffStartIndx = flowSpecTmpBuff.writerIndex();

    flowSpec = bgpFlowSpecNlri.flowSpecComponents();
    listIterator = flowSpec.listIterator();

    while (listIterator.hasNext()) {
        BgpValueType tlv = listIterator.next();
        writeFlowType(tlv, flowSpecTmpBuff);
    }

    /* RFC 5575: section 4,  If the NLRI length value is smaller than 240 (0xf0 hex), the length
                             field can be encoded as a single octet.  Otherwise, it is encoded as
                             an extended-length 2-octet values */
    int len = flowSpecTmpBuff.writerIndex() - tmpBuffStartIndx;
    if (len >= FLOW_SPEC_LEN) {
        cb.writeShort(len);
    } else {
        cb.writeByte(len);
    }
    //Copy from bynamic buffer to channel buffer
    cb.writeBytes(flowSpecTmpBuff);
}
 
Example 23
Project: Reer   File: StatementReplacingVisitorSupport.java   Source Code and License 5 votes vote down vote up
/**
 * 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()));
    }
}
 
Example 24
Project: Reer   File: FilteredList.java   Source Code and License 5 votes vote down vote up
public ListIterator<S> listIterator(int index) {
    ListIterator<S> iterator = listIterator();
    for (int i = 0; i < index; i++) {
        iterator.next();
    }
    return iterator;
}
 
Example 25
Project: node-boilerpipe   File: IgnoreBlocksAfterContentFromEndFilter.java   Source Code and License 5 votes vote down vote up
public boolean process(TextDocument doc) throws BoilerpipeProcessingException {
  boolean changes = false;

  int words = 0;

  List<TextBlock> blocks = doc.getTextBlocks();
  if (!blocks.isEmpty()) {
    ListIterator<TextBlock> it = blocks.listIterator(blocks.size());

    TextBlock tb;

    while (it.hasPrevious()) {
      tb = it.previous();
      if (tb.hasLabel(DefaultLabels.INDICATES_END_OF_TEXT)) {
        tb.addLabel(DefaultLabels.STRICTLY_NOT_CONTENT);
        tb.removeLabel(DefaultLabels.MIGHT_BE_CONTENT);
        tb.setIsContent(false);
        changes = true;
      } else if (tb.isContent()) {
        words += tb.getNumWords();
        if (words > 200) {
          break;
        }
      }

    }
  }

  return changes;
}
 
Example 26
Project: hanlpStudy   File: WordBasedGenerativeModelSegment.java   Source Code and License 5 votes vote down vote up
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));
}
 
Example 27
Project: ContentAssist   File: diff_match_patch.java   Source Code and License 5 votes vote down vote up
/**
 * Do a quick line-level diff on both strings, then rediff the parts for
 * greater accuracy.
 * This speedup can produce non-minimal diffs.
 * @param text1 Old string to be diffed.
 * @param text2 New string to be diffed.
 * @param deadline Time when the diff should be complete by.
 * @return Linked List of Diff objects.
 */
private LinkedList<Diff> diff_lineMode(String text1, String text2,
                                       long deadline) {
  // Scan the text on a line-by-line basis first.
  LinesToCharsResult b = diff_linesToChars(text1, text2);
  text1 = b.chars1;
  text2 = b.chars2;
  List<String> linearray = b.lineArray;

  LinkedList<Diff> diffs = diff_main(text1, text2, false, deadline);

  // Convert the diff back to original text.
  diff_charsToLines(diffs, linearray);
  // Eliminate freak matches (e.g. blank lines)
  diff_cleanupSemantic(diffs);

  // Rediff any replacement blocks, this time character-by-character.
  // Add a dummy entry at the end.
  diffs.add(new Diff(Operation.EQUAL, ""));
  int count_delete = 0;
  int count_insert = 0;
  String text_delete = "";
  String text_insert = "";
  ListIterator<Diff> pointer = diffs.listIterator();
  Diff thisDiff = pointer.next();
  while (thisDiff != null) {
    switch (thisDiff.operation) {
    case INSERT:
      count_insert++;
      text_insert += thisDiff.text;
      break;
    case DELETE:
      count_delete++;
      text_delete += thisDiff.text;
      break;
    case EQUAL:
      // Upon reaching an equality, check for prior redundancies.
      if (count_delete >= 1 && count_insert >= 1) {
        // Delete the offending records and add the merged ones.
        pointer.previous();
        for (int j = 0; j < count_delete + count_insert; j++) {
          pointer.previous();
          pointer.remove();
        }
        for (Diff newDiff : diff_main(text_delete, text_insert, false,
            deadline)) {
          pointer.add(newDiff);
        }
      }
      count_insert = 0;
      count_delete = 0;
      text_delete = "";
      text_insert = "";
      break;
    }
    thisDiff = pointer.hasNext() ? pointer.next() : null;
  }
  diffs.removeLast();  // Remove the dummy entry at the end.

  return diffs;
}
 
Example 28
Project: LightSIP   File: SIPMessage.java   Source Code and License 5 votes vote down vote up
/**
 * Set a header from a linked list of headers.
 *
 * @param headers -- a list of headers to set.
 */
public void setHeaders(java.util.List<SIPHeader> headers) {
    ListIterator<SIPHeader> listIterator = headers.listIterator();
    while (listIterator.hasNext()) {
        SIPHeader sipHeader = (SIPHeader) listIterator.next();
        try {
            this.attachHeader(sipHeader, false);
        } catch (SIPDuplicateHeaderException ex) {
        }
    }
}
 
Example 29
Project: athena   File: BgpFlowSpecNlri.java   Source Code and License 5 votes vote down vote up
/**
 * Update buffer with identical flow types.
 *
 * @param cb channel buffer
 */
public static void updateBufferIdenticalFlowTypes(ChannelBuffer cb, BgpFlowSpecNlri bgpFlowSpecNlri) {

    List<BgpValueType> flowSpec = bgpFlowSpecNlri.flowSpecComponents();
    ListIterator<BgpValueType> listIterator = flowSpec.listIterator();

    while (listIterator.hasNext()) {
        ChannelBuffer flowSpecTmpBuff = ChannelBuffers.dynamicBuffer();
        int tmpBuffStartIndx = flowSpecTmpBuff.writerIndex();

        BgpValueType tlv = listIterator.next();
        writeFlowType(tlv, flowSpecTmpBuff);

        /* RFC 5575: section 4,  If the NLRI length value is smaller than 240 (0xf0 hex), the length
                                 field can be encoded as a single octet.  Otherwise, it is encoded as
                                 an extended-length 2-octet values */
        int len = flowSpecTmpBuff.writerIndex() - tmpBuffStartIndx;
        if (len >= FLOW_SPEC_LEN) {
            cb.writeShort(len);
        } else {
            cb.writeByte(len);
        }
        //Copy from bynamic buffer to channel buffer
        cb.writeBytes(flowSpecTmpBuff);
    }
    return;
}
 
Example 30
Project: GitHub   File: BaseRecyclerAdapter.java   Source Code and License 5 votes vote down vote up
/** 移除一条数据 */
public void removeItem(T item) {
    int position = 0;
    ListIterator<T> iterator = mDatas.listIterator();
    while (iterator.hasNext()) {
        T next = iterator.next();
        if (next == item) {
            iterator.remove();
            notifyItemRemoved(position);
        }
        position++;
    }
}
 
Example 31
Project: LivroJavaComoProgramar10Edicao   File: ListTest.java   Source Code and License 5 votes vote down vote up
private static void printReversedList(List<String> list)
{
   ListIterator<String> iterator = list.listIterator(list.size());

   System.out.printf("%nReversed List:%n");

   // print list in reverse order
   while (iterator.hasPrevious()) 
      System.out.printf("%s ", iterator.previous()); 
}
 
Example 32
Project: KSP-AGuS-Automatic-Guidance-System   File: TRANSFER_HOHMANN.java   Source Code and License 5 votes vote down vote up
/**
 * Will delete Maneuvers that had errors while creating
 */
private void deleteEmptyManeuver() {
	List<Integer> li = new ArrayList<Integer>();
	ListIterator<MANEUVER> mi = getManeuverList().listIterator();
	while (mi.hasNext()) {
		if (mi.next().errors()) {
			mi.remove();
		}
	}

}
 
Example 33
Project: OpenJSharp   File: DefaultKeyboardFocusManager.java   Source Code and License 5 votes vote down vote up
/**
 * Delays dispatching of KeyEvents until the specified Component becomes
 * the focus owner. KeyEvents with timestamps later than the specified
 * timestamp will be enqueued until the specified Component receives a
 * FOCUS_GAINED event, or the AWT cancels the delay request by invoking
 * <code>dequeueKeyEvents</code> or <code>discardKeyEvents</code>.
 *
 * @param after timestamp of current event, or the current, system time if
 *        the current event has no timestamp, or the AWT cannot determine
 *        which event is currently being handled
 * @param untilFocused Component which will receive a FOCUS_GAINED event
 *        before any pending KeyEvents
 * @see #dequeueKeyEvents
 * @see #discardKeyEvents
 */
protected synchronized void enqueueKeyEvents(long after,
                                             Component untilFocused) {
    if (untilFocused == null) {
        return;
    }

    if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
        focusLog.finer("Enqueue at {0} for {1}",
                   after, untilFocused);
    }

    int insertionIndex = 0,
        i = typeAheadMarkers.size();
    ListIterator<TypeAheadMarker> iter = typeAheadMarkers.listIterator(i);

    for (; i > 0; i--) {
        TypeAheadMarker marker = iter.previous();
        if (marker.after <= after) {
            insertionIndex = i;
            break;
        }
    }

    typeAheadMarkers.add(insertionIndex,
                         new TypeAheadMarker(after, untilFocused));
}
 
Example 34
Project: GitHub   File: RealmList.java   Source Code and License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
@Nonnull
public ListIterator<E> listIterator(int location) {
    if (isManaged()) {
        return new RealmListItr(location);
    } else {
        return super.listIterator(location);
    }
}
 
Example 35
Project: xdman   File: UnixFTPEntryParser.java   Source Code and License 5 votes vote down vote up
/**
 * Preparse the list to discard "total nnn" lines
 */
@Override
public List<String> preParse(List<String> original) {
    ListIterator<String> iter = original.listIterator();
    while (iter.hasNext()) {
        String entry = iter.next();
        if (entry.matches("^total \\d+$")) { // NET-389
            iter.remove();
        }
    }
    return original;
}
 
Example 36
Project: FactionsXL   File: FDefaultSidebar.java   Source Code and License 5 votes vote down vote up
public List<String> getOutput(FPlayer fplayer, List<String> content) {
    content = new ArrayList<>(content);
    ListIterator<String> it = content.listIterator();
    while (it.hasNext()) {
        it.set(replaceTags(fplayer, it.next()));
    }

    return content;
}
 
Example 37
Project: googles-monorepo-demo   File: Lists.java   Source Code and License 5 votes vote down vote up
/**
 * An implementation of {@link List#lastIndexOf(Object)}.
 */
static int lastIndexOfImpl(List<?> list, @Nullable Object element) {
  if (list instanceof RandomAccess) {
    return lastIndexOfRandomAccess(list, element);
  } else {
    ListIterator<?> listIterator = list.listIterator(list.size());
    while (listIterator.hasPrevious()) {
      if (Objects.equal(element, listIterator.previous())) {
        return listIterator.nextIndex();
      }
    }
    return -1;
  }
}
 
Example 38
Project: xsharing-services-router   File: RouteLegFactory.java   Source Code and License 5 votes vote down vote up
private static StationRepresentation extractStation(ListIterator<StationRepresentation> iterator) throws Exception {
    if (iterator.hasNext()) {
        return iterator.next();

    } else {
        throw new Exception();
    }
}
 
Example 39
Project: openjdk-jdk10   File: GraalCompilerTest.java   Source Code and License 5 votes vote down vote up
protected PhaseSuite<HighTierContext> getCustomGraphBuilderSuite(GraphBuilderConfiguration gbConf) {
    PhaseSuite<HighTierContext> suite = getDefaultGraphBuilderSuite();
    ListIterator<BasePhase<? super HighTierContext>> iterator = suite.findPhase(GraphBuilderPhase.class);
    initializeInvocationPluginExtensions();
    GraphBuilderConfiguration gbConfCopy = editGraphBuilderConfiguration(gbConf.copy());
    iterator.remove();
    iterator.add(new GraphBuilderPhase(gbConfCopy));
    return suite;
}
 
Example 40
Project: googles-monorepo-demo   File: Lists.java   Source Code and License 5 votes vote down vote up
@Override
public ListIterator<T> listIterator(int index) {
  return new TransformedListIterator<F, T>(fromList.listIterator(index)) {
    @Override
    T transform(F from) {
      return function.apply(from);
    }
  };
}
 
Example 41
Project: VASSAL-src   File: Node.java   Source Code and License 5 votes vote down vote up
public String getPath() {
  synchronized (children) {
    SequenceEncoder se = new SequenceEncoder('/');
    List<Node> path = getPathList();
    for (ListIterator<Node> i = path.listIterator(path.size());
         i.hasPrevious(); ) {
      se.append(i.previous().getId());
    }
    return se.getValue();
  }
}
 
Example 42
Project: jmt   File: NodeList.java   Source Code and License 5 votes vote down vote up
/** Gets the node with a specific name in the list.
 * @return Reference to the node .
 */
public NetNode get(String name) {
	ListIterator<NetNode> iterator = nodes.listIterator();
	NetNode node;
	while (iterator.hasNext()) {
		node = iterator.next();
		if (node.getName().compareTo(name) == 0) {
			return node;
		}
	}
	return null;
}
 
Example 43
Project: feeyo-redisproxy   File: MappedFileQueue.java   Source Code and License 5 votes vote down vote up
public boolean resetOffset(long offset) {
    MappedFile mappedFileLast = getLastMappedFile();

    if (mappedFileLast != null) {
        long lastOffset = mappedFileLast.getFileFromOffset() +
            mappedFileLast.getWrotePosition();
        long diff = lastOffset - offset;

        final int maxDiff = this.mappedFileSize * 2;
        if (diff > maxDiff)
            return false;
    }

    ListIterator<MappedFile> iterator = this.mappedFiles.listIterator();

    while (iterator.hasPrevious()) {
        mappedFileLast = iterator.previous();
        if (offset >= mappedFileLast.getFileFromOffset()) {
            int where = (int) (offset % mappedFileLast.getFileSize());
            mappedFileLast.setFlushedPosition(where);
            mappedFileLast.setWrotePosition(where);
            break;
        } else {
            iterator.remove();
        }
    }
    return true;
}
 
Example 44
Project: jdk8u-jdk   File: CopyOnWriteArrayList.java   Source Code and License 5 votes vote down vote up
public ListIterator<E> listIterator(int index) {
    final ReentrantLock lock = l.lock;
    lock.lock();
    try {
        checkForComodification();
        if (index < 0 || index > size)
            throw new IndexOutOfBoundsException("Index: "+index+
                                                ", Size: "+size);
        return new COWSubListIterator<E>(l, index, offset, size);
    } finally {
        lock.unlock();
    }
}
 
Example 45
Project: guava-mock   File: Lists.java   Source Code and License 5 votes vote down vote up
/**
 * An implementation of {@link List#addAll(int, Collection)}.
 */
static <E> boolean addAllImpl(List<E> list, int index, Iterable<? extends E> elements) {
  boolean changed = false;
  ListIterator<E> listIterator = list.listIterator(index);
  for (E e : elements) {
    listIterator.add(e);
    changed = true;
  }
  return changed;
}
 
Example 46
Project: LightSIP   File: ExtensionHeaderList.java   Source Code and License 5 votes vote down vote up
public String encode() {
    StringBuilder retval = new StringBuilder();
    ListIterator<ExtensionHeaderImpl> it = this.listIterator();
    while(it.hasNext()) {
       ExtensionHeaderImpl eh = (ExtensionHeaderImpl) it.next();
       retval.append(eh.encode());
    }
    return retval.toString();
}
 
Example 47
Project: Luyten4Forge   File: MainMenuBar.java   Source Code and License 5 votes vote down vote up
public void updateRecentFiles() {
	if (RecentFiles.paths.isEmpty()) {
		recentFiles.setEnabled(false);
		clearRecentFiles.setEnabled(false);
		return;
	} else {
		recentFiles.setEnabled(true);
		clearRecentFiles.setEnabled(true);
	}
	
	recentFiles.removeAll();
	ListIterator<String> li = RecentFiles.paths.listIterator(RecentFiles.paths.size());
	boolean rfSaveNeeded = false;
	
	while (li.hasPrevious()) {
		String path = li.previous();
		final File file = new File(path);
		
		if (!file.exists()) {
			rfSaveNeeded = true;
			continue;
		}
		
		JMenuItem menuItem = new JMenuItem(path);
		menuItem.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				ExtractMappings.currentFile = file;
				mainWindow.getModel().loadFile(file);
			}
		});
		recentFiles.add(menuItem);
	}
	
	if (rfSaveNeeded) RecentFiles.save();
}
 
Example 48
Project: FirefoxData-android   File: CacheEntryUpdater.java   Source Code and License 5 votes vote down vote up
private void removeCacheEntry1xxWarnings(final List<Header> cacheEntryHeaderList, final HttpCacheEntry entry) {
    final ListIterator<Header> cacheEntryHeaderListIter = cacheEntryHeaderList.listIterator();

    while (cacheEntryHeaderListIter.hasNext()) {
        final String cacheEntryHeaderName = cacheEntryHeaderListIter.next().getName();

        if (HeaderConstants.WARNING.equals(cacheEntryHeaderName)) {
            for (final Header cacheEntryWarning : entry.getHeaders(HeaderConstants.WARNING)) {
                if (cacheEntryWarning.getValue().startsWith("1")) {
                    cacheEntryHeaderListIter.remove();
                }
            }
        }
    }
}
 
Example 49
Project: n4js   File: DocCommentLookup.java   Source Code and License 5 votes vote down vote up
/**
 * Select comment closest to lookup element. Assume comments to be ordered list. Ignores comments starting with
 * doublestar.
 *
 * @param comments
 *            list of commnets on luukup elements
 * @throws InstantiationException
 *             if comment is malformed
 */
protected CommentCandidate pickCommentNoDoubleStar(List<INode> comments) throws InstantiationException {
	ListIterator<INode> iter = comments.listIterator(comments.size());
	String candidateTextString = null;
	while (iter.hasPrevious()) {
		candidateTextString = iter.previous().getText();
		if (!candidateTextString.startsWith("/**")) {
			return new CommentCandidate(candidateTextString);
		}
	}
	return null;
}
 
Example 50
Project: athena   File: ReferenceListenerTest.java   Source Code and License 5 votes vote down vote up
/**
 * Checks reference statement as sub-statement of list.
 */
@Test
public void processListSubStatementReference() throws IOException, ParserException {

    YangNode node = manager.getDataModel("src/test/resources/ListSubStatementReference.yang");

    assertThat((node instanceof YangModule), is(true));

    // Check whether the node type is set properly to module.
    assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));

    // Check whether the module name is set correctly.
    YangModule yangNode = (YangModule) node;
    assertThat(yangNode.getName(), is("Test"));

    // Check whether the list is child of module and description value is set correctly.
    YangList yangList = (YangList) yangNode.getChild();
    assertThat(yangList.getName(), is("valid"));
    assertThat(yangList.isConfig(), is(true));
    assertThat(yangList.getReference(), is("\"list reference\""));

    // Check whether leaf properties as set correctly.
    ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
    YangLeaf leafInfo = leafIterator.next();

    assertThat(leafInfo.getName(), is("invalid-interval"));
    assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
    assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
    assertThat(leafInfo.getUnits(), is("\"seconds\""));
    assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
    assertThat(leafInfo.isMandatory(), is(true));
    assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
    assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
}
 
Example 51
Project: jmt   File: NetSystem.java   Source Code and License 5 votes vote down vote up
/** Stops the NetSystem Engine and terminates the simulation.
 * @param Network Reference to the network to be stopped.
 */
public static void stop(QueueNetwork Network) {
	NetNode node;
	if (Network.getState() == QueueNetwork.STATE_RUNNING) {
		/* Informs ALL nodes of stop event and not only Reference nodes */
		ListIterator<NetNode> nodes = Network.getNodes().listIterator();
		while (nodes.hasNext()) {
			node = nodes.next();
			node.send(NetEvent.EVENT_STOP, null, 0.0, NodeSection.NO_ADDRESS, NodeSection.NO_ADDRESS, node);
		}
		Network.setState(QueueNetwork.STATE_STOPPED);
	}
}
 
Example 52
Project: SpaceGame   File: PlanetComponent.java   Source Code and License 5 votes vote down vote up
/**
 * Mark a given range as not free
 *
 * @param min - the minimum angle
 * @param max - the maximum angle
 * @param planet - the parent planet
 *
 * @return whether the component changed
 */
public boolean addBuildingInRange(float min, float max, Entity planet) {
    if (freeSpaces.isEmpty()) {
        //If no ranges add a range representing the open space
        freeSpaces.add(new AngleRange(max, min));
        return true;
    }

    ListIterator<AngleRange> iterator = freeSpaces.listIterator();
    while (iterator.hasNext()) {
        AngleRange curr = iterator.next();
        if (curr.isInRange(min)) {
            if (curr.isInRange(max)) {
                AngleRange rangeHigh;
                if (curr.getMaxD() > 360) {
                    rangeHigh = new AngleRange(max, curr.getMaxD() - 360);
                    curr.setMax(min);
                } else {
                    rangeHigh = new AngleRange(max, curr.getMaxD());
                    curr.setMax(min);
                }
                
                iterator.add(rangeHigh);
                return true;
            } else {
                //Only one side is in the range
                return false;
            }
        }
    }
    //Failed to find a range
    return false;
}
 
Example 53
Project: Saiy-PS   File: SoundEffectHelper.java   Source Code and License 5 votes vote down vote up
private ArrayList<SoundEffectItem> getValidatedArray() {
    if (DEBUG) {
        MyLog.i(CLS_NAME, "getValidatedArray: " + itemArray.size());
    }

    if (UtilsList.notNaked(itemArray)) {

        final ListIterator<SoundEffectItem> itr = itemArray.listIterator(itemArray.size() - 1);

        if (itr.hasNext()) {
            final SoundEffectItem item = itr.next();

            if (DEBUG) {
                MyLog.i(CLS_NAME, "getValidatedArray: getText: " + item.getText());
                MyLog.i(CLS_NAME, "getValidatedArray: getUtteranceId: " + item.getUtteranceId());
                MyLog.i(CLS_NAME, "getValidatedArray: soundEffect: " + item.getItemType());
            }

            switch (item.getItemType()) {

                case SoundEffectItem.SILENCE:
                    if (DEBUG) {
                        MyLog.i(CLS_NAME, "getValidatedArray: removing silence");
                    }
                    itr.remove();
                    return getValidatedArray();
                default:
                    if (DEBUG) {
                        MyLog.i(CLS_NAME, "getValidatedArray: updating to ARRAY_LAST");
                    }
                    item.setUtteranceId(ARRAY_LAST + ARRAY_DELIMITER + utteranceId);
                    break;
            }
        }
    }

    return itemArray;
}
 
Example 54
Project: Spark   File: SparksList.java   Source Code and License 5 votes vote down vote up
public final void drawSparks()
{
	final ListIterator<Sparks> iterator = SparkList.listIterator();

	while (iterator.hasNext())
	{
		final Sparks spark = iterator.next();

		if (spark.Active == true)
		{
			spark.Render();
		}
	}
}
 
Example 55
Project: incubator-netbeans   File: FetchAction.java   Source Code and License 5 votes vote down vote up
static Map<String, GitTransportUpdate> fetchRepeatedly (GitClient client, ProgressMonitor monitor,
        String target, List<String> fetchRefSpecs) throws GitException {
    List<String> fetchRefSpecsList = new ArrayList<>(fetchRefSpecs);
    Map<String, GitTransportUpdate> result = null;
    while (result == null && !fetchRefSpecsList.isEmpty() && !monitor.isCanceled()) {
        try {
            result = client.fetch(target, fetchRefSpecsList, monitor);
        } catch (GitException ex) {
            boolean found = false;
            if (fetchRefSpecsList.size() > 1) {
                for (ListIterator<String> it = fetchRefSpecsList.listIterator(); it.hasNext(); ) {
                    String refSpec = it.next();
                    String remoteHead = GitUtils.parseRemoteHeadFromFetch(refSpec);
                    if (refSpec != null && ex.getMessage().toLowerCase().matches(
                            MessageFormat.format(".*remote does not have {0} available for fetch.*", remoteHead))) { //NOI18N
                        it.remove();
                        found = true;
                        Logger.getLogger(FetchAction.class.getName()).log(Level.INFO,
                                "Remote does not have head according to spec {0}, trying fetching without the spec.", refSpec); //NOI18N
                        break;
                    }
                }
            }
            if (!found) {
                throw ex;
            }
        }
    }
    return result;
}
 
Example 56
Project: luna   File: BasicLibTest.java   Source Code and License 5 votes vote down vote up
@Override
protected void invoke(ExecutionContext context, ArgumentIterator args)
    throws ResolvedControlThrowable {
  final ListIterator iterator = args.nextOfClass(ListIterator.class);
  if (!iterator.hasNext()) {
    context.getReturnBuffer().setTo(null);
    return;
  }
  final Object next = iterator.next();

  context.getReturnBuffer().setTo(next);
}
 
Example 57
Project: incubator-netbeans   File: ConnectTest.java   Source Code and License 5 votes vote down vote up
private void assertSettings (List<ConnectionSettings> expectedSettings) {
    List<ConnectionSettings> settings = GitModuleConfig.getDefault().getRecentConnectionSettings();
    assertEquals(expectedSettings.size(), settings.size());
    for (ConnectionSettings expected : expectedSettings) {
        boolean ok = false;
        for (ListIterator<ConnectionSettings> it = settings.listIterator(); it.hasNext(); ) {
            ConnectionSettings sett = it.next();
            String expectedUriString = expected.getUri().setUser(null).setPass(null).toString();
            String uriString = sett.getUri().setUser(null).setPass(null).toString();
            String expectedUser = expected.getUser();
            String user = sett.getUser();
            String expectedPassword = expected.getPassword() == null ? "" : new String(expected.getPassword());
            String expectedPasshrase = expected.getPassphrase() == null ? "" : new String(expected.getPassphrase());
            String password = sett.getPassword() == null ? "" : new String(sett.getPassword());
            String passhrase = sett.getPassphrase() == null ? "" : new String(sett.getPassphrase());
            
            if (expectedUriString.equals(uriString) && user.equals(expectedUser) && password.equals(expectedPassword) && passhrase.equals(expectedPasshrase)
                    && expected.isPrivateKeyAuth() == sett.isPrivateKeyAuth() && expected.isSaveCredentials() == sett.isSaveCredentials()) {
                it.remove();
                ok = true;
                break;
            }
        }
        if (!ok) {
            fail(expected.getUri().toString());
        }
    }
}
 
Example 58
Project: HCFCore   File: TreeList.java   Source Code and License 5 votes vote down vote up
/**
 * Gets a ListIterator over the list.
 *
 * @param fromIndex  the index to start from
 * @return the new iterator
 */
@Override
public ListIterator<E> listIterator(final int fromIndex) {
    // override to go 75% faster
    // cannot use EmptyIterator as iterator.add() must work
    checkInterval(fromIndex, 0, size());
    return new TreeListIterator<E>(this, fromIndex);
}
 
Example 59
Project: hadoop   File: FSDirXAttrOp.java   Source Code and License 5 votes vote down vote up
/**
 * Filter XAttrs from a list of existing XAttrs. Removes matched XAttrs from
 * toFilter and puts them into filtered. Upon completion,
 * toFilter contains the filter XAttrs that were not found, while
 * fitleredXAttrs contains the XAttrs that were found.
 *
 * @param existingXAttrs Existing XAttrs to be filtered
 * @param toFilter XAttrs to filter from the existing XAttrs
 * @param filtered Return parameter, XAttrs that were filtered
 * @return List of XAttrs that does not contain filtered XAttrs
 */
@VisibleForTesting
static List<XAttr> filterINodeXAttrs(
    final List<XAttr> existingXAttrs, final List<XAttr> toFilter,
    final List<XAttr> filtered)
  throws AccessControlException {
  if (existingXAttrs == null || existingXAttrs.isEmpty() ||
      toFilter == null || toFilter.isEmpty()) {
    return existingXAttrs;
  }

  // Populate a new list with XAttrs that pass the filter
  List<XAttr> newXAttrs =
      Lists.newArrayListWithCapacity(existingXAttrs.size());
  for (XAttr a : existingXAttrs) {
    boolean add = true;
    for (ListIterator<XAttr> it = toFilter.listIterator(); it.hasNext()
        ;) {
      XAttr filter = it.next();
      Preconditions.checkArgument(
          !KEYID_XATTR.equalsIgnoreValue(filter),
          "The encryption zone xattr should never be deleted.");
      if (UNREADABLE_BY_SUPERUSER_XATTR.equalsIgnoreValue(filter)) {
        throw new AccessControlException("The xattr '" +
            SECURITY_XATTR_UNREADABLE_BY_SUPERUSER + "' can not be deleted.");
      }
      if (a.equalsIgnoreValue(filter)) {
        add = false;
        it.remove();
        filtered.add(filter);
        break;
      }
    }
    if (add) {
      newXAttrs.add(a);
    }
  }

  return newXAttrs;
}
 
Example 60
Project: r8   File: BasicBlockIteratorTest.java   Source Code and License 5 votes vote down vote up
@Test
public void removeBeforeNext() {
  IRCode code = simpleCode();

  ListIterator<BasicBlock> blocks = code.listIterator();
  thrown.expect(IllegalStateException.class);
  blocks.remove();
}