Tabnine Logo
List.indexOf
Code IndexAdd Tabnine to your IDE (free)

How to use
indexOf
method
in
java.util.List

Best Java code snippets using java.util.List.indexOf (Showing top 20 results out of 40,032)

Refine searchRefine arrow

  • List.get
  • List.size
  • List.add
  • List.remove
  • List.contains
origin: gocd/gocd

private int removeParent(Node parentNode) {
  int index = parents.indexOf(parentNode);
  parents.remove(parentNode);
  return index;
}
origin: apache/storm

@Override
public Object getValueByField(String field) {
  return values.get(keys.indexOf(field));
}
origin: alibaba/druid

@Override
public void rollback(Savepoint savepoint) throws SQLException {
  checkState();
  int index = this.savepoints.indexOf(savepoint);
  if (index == -1) {
    throw new SQLException("savepoint not contained");
  }
  for (int i = savepoints.size() - 1; i >= index; --i) {
    savepoints.remove(i);
  }
}
origin: wildfly/wildfly

  private void pickAnycastTargets(List<Address> anycast_targets) {
    int index=dests.indexOf(local_addr);
    for(int i=index + 1; i < index + 1 + anycast_count; i++) {
      int new_index=i % dests.size();
      Address tmp=dests.get(new_index);
      if(!anycast_targets.contains(tmp))
        anycast_targets.add(tmp);
    }
  }
}
origin: prestodb/presto

public PartitioningScheme translateOutputLayout(List<Symbol> newOutputLayout)
{
  requireNonNull(newOutputLayout, "newOutputLayout is null");
  checkArgument(newOutputLayout.size() == outputLayout.size());
  Partitioning newPartitioning = partitioning.translate(symbol -> newOutputLayout.get(outputLayout.indexOf(symbol)));
  Optional<Symbol> newHashSymbol = hashColumn
      .map(outputLayout::indexOf)
      .map(newOutputLayout::get);
  return new PartitioningScheme(newPartitioning, newOutputLayout, newHashSymbol, replicateNullsAndAny, bucketToPartition);
}
origin: ReactiveX/RxJava

assertEquals(0, list.size());
assertFalse(list.contains(1));
assertFalse(list.remove((Integer)1));
assertTrue(list.contains(2));
assertFalse(list.remove((Integer)10));
assertEquals(7, list.size());
assertEquals(7, list.size());
  assertEquals(i, list.get(i - 1).intValue());
assertEquals(2, list.indexOf(3));
assertFalse(list.equals(list3));
list3.add(7);
assertTrue(list3.equals(list));
assertTrue(list.equals(list3));
assertEquals(list.toString(), list3.toString());
list.remove(0);
assertEquals(6, list.size());
origin: apache/hive

private static int registerExpression(List<RexNode> exprList, RexNode node) {
 int i = exprList.indexOf(node);
 if (i < 0) {
  i = exprList.size();
  exprList.add(node);
 }
 return i;
}
origin: google/guava

@MapFeature.Require(SUPPORTS_PUT)
public void testReplaceAllRotate() {
 getMap()
   .replaceAll(
     (K k, V v) -> {
      int index = keys().asList().indexOf(k);
      return values().asList().get(index + 1);
     });
 List<Entry<K, V>> expectedEntries = new ArrayList<>();
 for (Entry<K, V> entry : getSampleEntries()) {
  int index = keys().asList().indexOf(entry.getKey());
  expectedEntries.add(Helpers.mapEntry(entry.getKey(), values().asList().get(index + 1)));
 }
 expectContents(expectedEntries);
}
origin: stanfordnlp/CoreNLP

private void changeStartTimes(List<LatticeWord> words, int newStartTime) {
 ArrayList<LatticeWord> toRemove = new ArrayList<>();
 for (LatticeWord lw : words) {
  latticeWords.remove(lw);
  int oldStartTime = lw.startNode;
  lw.startNode = newStartTime;
  if (latticeWords.contains(lw)) {
   if (DEBUG) {
    log.info("duplicate found");
   LatticeWord twin = latticeWords.get(latticeWords.indexOf(lw));
   latticeWords.add(lw);
   if (oldStartTime != newStartTime) {
origin: apache/kylin

private void mappingKeys(int key, Pair<RexNode, String> project, List<Pair<RexNode, String>> projects, Map<Integer, Integer> mapping) {
  if (!projects.contains(project)) {
    projects.add(project);
  }
  mapping.put(key, projects.indexOf(project));
}
origin: airbnb/epoxy

void addAttributes(Collection<AttributeInfo> attributesToAdd) {
 removeMethodIfDuplicatedBySetter(attributesToAdd);
 for (AttributeInfo info : attributesToAdd) {
  int existingIndex = attributeInfo.indexOf(info);
  if (existingIndex > -1) {
   // Don't allow duplicates.
   attributeInfo.set(existingIndex, info);
  } else {
   attributeInfo.add(info);
  }
 }
}
origin: apache/incubator-shardingsphere

private static void changeColumnDefinitionPosition(final ColumnAfterPositionSegment columnAfterPositionSegment, final List<ColumnMetaData> columnMetaDataList) {
  Optional<ColumnMetaData> columnMetaData = find(columnAfterPositionSegment.getColumnName(), columnMetaDataList);
  Optional<ColumnMetaData> afterColumnMetaData = find(columnAfterPositionSegment.getAfterColumnName(), columnMetaDataList);
  if (columnMetaData.isPresent() && afterColumnMetaData.isPresent()) {
    columnMetaDataList.remove(columnMetaData.get());
    columnMetaDataList.add(columnMetaDataList.indexOf(afterColumnMetaData.get()) + 1, columnMetaData.get());
  }
}

origin: jMonkeyEngine/jmonkeyengine

private boolean assertValidVertex(Vertex v) {
  // Allows to find bugs in collapsing.
  //       System.out.println("Asserting " + v.index);
  for (Triangle t : v.triangles) {
    for (int i = 0; i < 3; i++) {
      //             System.out.println("check " + t.vertex[i].index);
      //assert (collapseCostSet.contains(t.vertex[i]));
      assert (find(collapseCostSet, t.vertex[i]));
      
      assert (t.vertex[i].edges.contains(new Edge(t.vertex[i].collapseTo)));
      for (int n = 0; n < 3; n++) {
        if (i != n) {
          
          int id = t.vertex[i].edges.indexOf(new Edge(t.vertex[n]));
          Edge ed = t.vertex[i].edges.get(id);
          //assert (ed.collapseCost != UNINITIALIZED_COLLAPSE_COST);
        } else {
          assert (!t.vertex[i].edges.contains(new Edge(t.vertex[n])));
        }
      }
    }
  }
  return true;
}
 
origin: google/guava

@Override
public int indexOf(Object o) {
 if (!(o instanceof List)) {
  return -1;
 }
 List<?> list = (List<?>) o;
 if (list.size() != axes.size()) {
  return -1;
 }
 ListIterator<?> itr = list.listIterator();
 int computedIndex = 0;
 while (itr.hasNext()) {
  int axisIndex = itr.nextIndex();
  int elemIndex = axes.get(axisIndex).indexOf(itr.next());
  if (elemIndex == -1) {
   return -1;
  }
  computedIndex += elemIndex * axesSizeProduct[axisIndex + 1];
 }
 return computedIndex;
}
origin: k9mail/k-9

public void setAlternateRecipientInfo(List<Recipient> recipients) {
  this.recipients = recipients;
  int indexOfCurrentRecipient = recipients.indexOf(currentRecipient);
  if (indexOfCurrentRecipient >= 0) {
    currentRecipient = recipients.get(indexOfCurrentRecipient);
  }
  recipients.remove(currentRecipient);
  notifyDataSetChanged();
}
origin: jersey/jersey

private void checkValueProviders(ResourceMethod method) {
  List<? extends Function<ContainerRequest, ?>> valueProviders =
      ParameterValueHelper.createValueProviders(valueParamProviders, method.getInvocable());
  if (valueProviders.contains(null)) {
    int index = valueProviders.indexOf(null);
    Errors.fatal(method, LocalizationMessages.ERROR_PARAMETER_MISSING_VALUE_PROVIDER(index, method.getInvocable()
        .getHandlingMethod()));
  }
}
origin: aragozin/jvm-tools

public void append(String[] hdr, String[] values) {
  for(String h: hdr) {
    if (!header.contains(h)) {
      header.add(h);
    }
  }
  String[] row = new String[header.size()];
  for(int i = 0; i != hdr.length; ++i) {
    int n = header.indexOf(hdr[i]);
    row[n] = values[i];
  }
  rows.add(row);
}

origin: JetBrains/ideavim

private void selectWindow(@NotNull EditorWindow currentWindow, @NotNull List<EditorWindow> windows,
             int relativePosition) {
 final int pos = windows.indexOf(currentWindow);
 final int selected = pos + relativePosition;
 final int normalized = Math.max(0, Math.min(selected, windows.size() - 1));
 windows.get(normalized).setAsCurrentWindow(true);
}
origin: aragozin/jvm-tools

private void ensureCounter(String key) throws IOException {
  int n = counterKeys.indexOf(key);
  if (n < 0) {
    n = counterKeys.size();
    counterKeys.add(key);
    dos.write(StackTraceCodec.TAG_COUNTER);
    dos.writeUTF(key);
  }
}
origin: stanfordnlp/CoreNLP

/**
 * Inserts the given specific portion of an uncollapsed relation back into the
 * targetList
 *
 * @param specific Specific relation to put in.
 * @param relnTgtNode Node governed by the uncollapsed relation
 * @param tgtList Target List of words
 */
private void insertSpecificIntoList(String specific, IndexedWord relnTgtNode, List<IndexedWord> tgtList) {
 int currIndex = tgtList.indexOf(relnTgtNode);
 Set<IndexedWord> descendants = descendants(relnTgtNode);
 IndexedWord specificNode = new IndexedWord();
 specificNode.set(CoreAnnotations.LemmaAnnotation.class, specific);
 specificNode.set(CoreAnnotations.TextAnnotation.class, specific);
 specificNode.set(CoreAnnotations.OriginalTextAnnotation.class, specific);
 while ((currIndex >= 1) && descendants.contains(tgtList.get(currIndex - 1))) {
  currIndex--;
 }
 tgtList.add(currIndex, specificNode);
}
java.utilListindexOf

Javadoc

Searches this List for the specified object and returns the index of the first occurrence.

Popular methods of List

  • add
  • size
    Returns the number of elements in this List.
  • get
    Returns the element at the specified location in this List.
  • isEmpty
    Returns whether this List contains no elements.
  • addAll
  • toArray
    Returns an array containing all elements contained in this List. If the specified array is large eno
  • contains
    Tests whether this List contains the specified object.
  • remove
    Removes the first occurrence of the specified object from this List.
  • iterator
    Returns an iterator on the elements of this List. The elements are iterated in the same order as the
  • clear
  • stream
  • forEach
  • stream,
  • forEach,
  • set,
  • subList,
  • equals,
  • hashCode,
  • removeAll,
  • listIterator,
  • sort

Popular in Java

  • Making http requests using okhttp
  • scheduleAtFixedRate (Timer)
  • startActivity (Activity)
  • getApplicationContext (Context)
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now