Java ListIterator Usage containsUsingListIteratorNext(List list, Integer value)

Here you can find the source of containsUsingListIteratorNext(List list, Integer value)

Description

contains Using List Iterator Next

License

Apache License

Declaration

public static boolean containsUsingListIteratorNext(List<Integer> list, Integer value) 

Method Source Code

//package com.java2s;
/*/*w w  w. ja v  a2 s  .com*/
   Copyright (c) 2012 LinkedIn Corp.
    
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
    
   http://www.apache.org/licenses/LICENSE-2.0
    
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/

import java.util.List;
import java.util.ListIterator;

public class Main {
    public static boolean containsUsingListIteratorNext(List<Integer> list, Integer value) {
        boolean found = false;
        for (ListIterator<Integer> it = list.listIterator(); it.hasNext();) {
            if (it.next().equals(value))
                found = true;
        }
        return found;
    }
}

Related

  1. castIterator(final Iterator iterator)
  2. clearNulls(Collection col)
  3. createCommaSeparatedListOfFullTypeNames(ListIterator strIt)
  4. differingDigits(final int lhs, final int rhs, final int base)
  5. emptyIterator()
  6. filterStringList(final String prefix, final String infix, final String suffix, final List list)