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

How to use
set
method
in
java.util.List

Best Java code snippets using java.util.List.set (Showing top 20 results out of 45,333)

Refine searchRefine arrow

  • List.get
  • List.size
  • List.add
  • RepeatedFieldBuilder.setMessage
  • RepeatedFieldBuilderV3.setMessage
  • Map.get
  • List.remove
origin: stackoverflow.com

 public class Collections { 
 public static <T> void copy(List<? super T> dest, List<? extends T> src) 
 {
   for (int i=0; i<src.size(); i++) 
    dest.set(i,src.get(i)); 
 } 
}
origin: apache/incubator-dubbo

/**
 * push.
 *
 * @param ele
 */
public void push(E ele) {
  if (mElements.size() > mSize) {
    mElements.set(mSize, ele);
  } else {
    mElements.add(ele);
  }
  mSize++;
}
origin: hankcs/HanLP

public void setPenalty(int i, int j, double penalty)
{
  if (penalty_.isEmpty())
  {
    for (int s = 0; s < node_.size(); s++)
    {
      List<Double> penaltys = Arrays.asList(new Double[ysize_]);
      penalty_.add(penaltys);
    }
  }
  penalty_.get(i).set(j, penalty);
}
origin: apache/flink

private void cleanUp() {
  // invalidate row
  final Row deleteRow = materializedTable.get(validRowPosition);
  if (rowPositionCache.get(deleteRow) == validRowPosition) {
    // this row has no duplicates in the materialized table,
    // it can be removed from the cache
    rowPositionCache.remove(deleteRow);
  }
  materializedTable.set(validRowPosition, null);
  validRowPosition++;
  // perform clean up in batches
  if (validRowPosition >= overcommitThreshold) {
    materializedTable.subList(0, validRowPosition).clear();
    // adjust all cached indexes
    rowPositionCache.replaceAll((k, v) -> v - validRowPosition);
    validRowPosition = 0;
  }
}
origin: skylot/jadx

/**
 * Replace insn by index i in block,
 * for proper copy attributes, assume attributes are not overlap
 */
private static void replaceInsn(BlockNode block, int i, InsnNode insn) {
  InsnNode prevInsn = block.getInstructions().get(i);
  insn.copyAttributesFrom(prevInsn);
  insn.setSourceLine(prevInsn.getSourceLine());
  block.getInstructions().set(i, insn);
}
origin: apache/hbase

/**
 * Shuffle the assignment plan by switching two favored node positions.
 * @param plan The assignment plan
 * @param p1 The first switch position
 * @param p2 The second switch position
 * @return
 */
private FavoredNodesPlan shuffleAssignmentPlan(FavoredNodesPlan plan,
  FavoredNodesPlan.Position p1, FavoredNodesPlan.Position p2) throws IOException {
 FavoredNodesPlan shuffledPlan = new FavoredNodesPlan();
 Map<String, RegionInfo> regionToHRegion =
   rp.getRegionAssignmentSnapshot().getRegionNameToRegionInfoMap();
 for (Map.Entry<String, List<ServerName>> entry :
  plan.getAssignmentMap().entrySet()) {
  // copy the server list from the original plan
  List<ServerName> shuffledServerList = new ArrayList<>();
  shuffledServerList.addAll(entry.getValue());
  // start to shuffle
  shuffledServerList.set(p1.ordinal(), entry.getValue().get(p2.ordinal()));
  shuffledServerList.set(p2.ordinal(), entry.getValue().get(p1.ordinal()));
  // update the plan
  shuffledPlan.updateFavoredNodesMap(regionToHRegion.get(entry.getKey()), shuffledServerList);
 }
 return shuffledPlan;
}
origin: fesh0r/fernflower

@Override
public void initExprents() {
 SwitchExprent swexpr = (SwitchExprent)first.getExprents().remove(first.getExprents().size() - 1);
 swexpr.setCaseValues(caseValues);
 headexprent.set(0, swexpr);
}
origin: google/guava

private static void assertTransformModifiable(List<String> list) {
 try {
  list.add("5");
  fail("transformed list is addable");
 } catch (UnsupportedOperationException expected) {
 }
 list.remove(0);
 assertEquals(asList("2", "3", "4"), list);
 list.remove("3");
 assertEquals(asList("2", "4"), list);
 try {
  list.set(0, "5");
  fail("transformed list is setable");
 } catch (UnsupportedOperationException expected) {
 }
 list.clear();
 assertEquals(Collections.emptyList(), list);
}
origin: google/guava

@CollectionSize.Require(absent = CollectionSize.ZERO)
public void testEquals_otherListContainingNull() {
 List<E> other = new ArrayList<>(getSampleElements());
 other.set(other.size() / 2, null);
 assertFalse(
   "Two Lists should not be equal if exactly one of them has null at a given index.",
   getList().equals(other));
}
origin: stanfordnlp/CoreNLP

/**
 * <code>repeated .edu.stanford.nlp.loglinear.model.proto.ConcatVector factorTable = 2;</code>
 */
public Builder setFactorTable(
  int index, edu.stanford.nlp.loglinear.model.proto.ConcatVectorProto.ConcatVector value) {
 if (factorTableBuilder_ == null) {
  if (value == null) {
   throw new NullPointerException();
  }
  ensureFactorTableIsMutable();
  factorTable_.set(index, value);
  onChanged();
 } else {
  factorTableBuilder_.setMessage(index, value);
 }
 return this;
}
/**
origin: apache/incubator-shardingsphere

/**
 * <code>repeated .authpb.Permission keyPermission = 2;</code>
 */
public Builder setKeyPermission(
  int index, authpb.Auth.Permission value) {
 if (keyPermissionBuilder_ == null) {
  if (value == null) {
   throw new NullPointerException();
  }
  ensureKeyPermissionIsMutable();
  keyPermission_.set(index, value);
  onChanged();
 } else {
  keyPermissionBuilder_.setMessage(index, value);
 }
 return this;
}
/**
origin: square/okhttp

/**
 * Removes a path segment. When this method returns the last segment is always "", which means
 * the encoded path will have a trailing '/'.
 *
 * <p>Popping "/a/b/c/" yields "/a/b/". In this case the list of path segments goes from ["a",
 * "b", "c", ""] to ["a", "b", ""].
 *
 * <p>Popping "/a/b/c" also yields "/a/b/". The list of path segments goes from ["a", "b", "c"]
 * to ["a", "b", ""].
 */
private void pop() {
 String removed = encodedPathSegments.remove(encodedPathSegments.size() - 1);
 // Make sure the path ends with a '/' by either adding an empty string or clearing a segment.
 if (removed.isEmpty() && !encodedPathSegments.isEmpty()) {
  encodedPathSegments.set(encodedPathSegments.size() - 1, "");
 } else {
  encodedPathSegments.add("");
 }
}
origin: spring-projects/spring-framework

@SuppressWarnings({"unchecked", "rawtypes"})
protected void visitList(List listVal) {
  for (int i = 0; i < listVal.size(); i++) {
    Object elem = listVal.get(i);
    Object newVal = resolveValue(elem);
    if (!ObjectUtils.nullSafeEquals(newVal, elem)) {
      listVal.set(i, newVal);
    }
  }
}
origin: apache/incubator-dubbo

/**
 * push.
 *
 * @param ele
 */
public void push(E ele) {
  if (mElements.size() > mSize) {
    mElements.set(mSize, ele);
  } else {
    mElements.add(ele);
  }
  mSize++;
}
origin: stanfordnlp/CoreNLP

private void lazyNext(PriorityQueue<Derivation> candV, Derivation derivation, int kPrime) {
 List<Vertex> tails = derivation.arc.tails;
 for  (int i = 0, sz = derivation.arc.size(); i < sz; i++) {
  List<Integer> j = new ArrayList<>(derivation.j);
  j.set(i, j.get(i)+1);
  Vertex Ti = tails.get(i);
  lazyKthBest(Ti, j.get(i), kPrime);
  LinkedList<Derivation> dHatTi = dHat.get(Ti);
  // compute score for this derivation
  if (j.get(i)-1 >= dHatTi.size()) { continue; }
  Derivation d = dHatTi.get(j.get(i)-1);
  double newScore = derivation.score - derivation.childrenScores.get(i) + d.score;
  List<Double> childrenScores = new ArrayList<>(derivation.childrenScores);
  childrenScores.set(i, d.score);
  Derivation newDerivation = new Derivation(derivation.arc, j, newScore, childrenScores);
  if (!candV.contains(newDerivation) && newScore > Double.NEGATIVE_INFINITY) {
   candV.add(newDerivation, newScore);
  }
 }
}
origin: google/guava

public void testAsList_toArray_roundTrip() {
 short[] array = {(short) 0, (short) 1, (short) 2};
 List<Short> list = Shorts.asList(array);
 short[] newArray = Shorts.toArray(list);
 // Make sure it returned a copy
 list.set(0, (short) 4);
 assertTrue(Arrays.equals(new short[] {(short) 0, (short) 1, (short) 2}, newArray));
 newArray[1] = (short) 5;
 assertEquals((short) 1, (short) list.get(1));
}
origin: fesh0r/fernflower

@Override
public void initExprents() {
 IfExprent ifexpr = (IfExprent)first.getExprents().remove(first.getExprents().size() - 1);
 if (negated) {
  ifexpr = (IfExprent)ifexpr.copy();
  ifexpr.negateIf();
 }
 headexprent.set(0, ifexpr);
}
origin: stanfordnlp/CoreNLP

/**
 * <code>repeated .edu.stanford.nlp.loglinear.model.proto.ConcatVector.Component component = 1;</code>
 */
public Builder setComponent(
  int index, edu.stanford.nlp.loglinear.model.proto.ConcatVectorProto.ConcatVector.Component.Builder builderForValue) {
 if (componentBuilder_ == null) {
  ensureComponentIsMutable();
  component_.set(index, builderForValue.build());
  onChanged();
 } else {
  componentBuilder_.setMessage(index, builderForValue.build());
 }
 return this;
}
/**
origin: apache/incubator-shardingsphere

/**
 * <code>repeated .authpb.Permission keyPermission = 2;</code>
 */
public Builder setKeyPermission(
  int index, authpb.Auth.Permission.Builder builderForValue) {
 if (keyPermissionBuilder_ == null) {
  ensureKeyPermissionIsMutable();
  keyPermission_.set(index, builderForValue.build());
  onChanged();
 } else {
  keyPermissionBuilder_.setMessage(index, builderForValue.build());
 }
 return this;
}
/**
origin: redisson/redisson

@Override
public synchronized void onSlotResult(List<Boolean> result) {
  for (int i = 0; i < result.size(); i++) {
    if (this.result.size() == i) {
      this.result.add(false);
    }
    this.result.set(i, this.result.get(i) | result.get(i));
  }
}
java.utilListset

Javadoc

Replaces the element at the specified location in this List with the specified object. This operation does not change the size of the List.

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,
  • subList,
  • indexOf,
  • 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.
  • Top plugins for Android Studio
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