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

How to use
get
method
in
java.util.List

Best Java code snippets using java.util.List.get (Showing top 20 results out of 297,378)

Refine searchRefine arrow

  • List.size
  • List.add
  • List.isEmpty
  • Assert.assertEquals
  • Test.<init>
  • Map.get
  • ArrayList.<init>
origin: spring-projects/spring-framework

private Node getParent() {
  if (!this.elements.isEmpty()) {
    return this.elements.get(this.elements.size() - 1);
  }
  else {
    return this.node;
  }
}
origin: square/okhttp

/** Returns the remote peer's principle, or null if that peer is anonymous. */
public @Nullable Principal peerPrincipal() {
 return !peerCertificates.isEmpty()
   ? ((X509Certificate) peerCertificates.get(0)).getSubjectX500Principal()
   : null;
}
origin: spring-projects/spring-framework

private static List<Element> prependWithSeparator(List<Element> elements) {
  List<Element> result = new ArrayList<>(elements);
  if (result.isEmpty() || !(result.get(0) instanceof Separator)) {
    result.add(0, SEPARATOR);
  }
  return Collections.unmodifiableList(result);
}
origin: square/okhttp

private List<String> percentDecode(List<String> list, boolean plusIsSpace) {
 int size = list.size();
 List<String> result = new ArrayList<>(size);
 for (int i = 0; i < size; i++) {
  String s = list.get(i);
  result.add(s != null ? percentDecode(s, plusIsSpace) : null);
 }
 return Collections.unmodifiableList(result);
}
origin: ReactiveX/RxJava

@Test
public void testOverlappingWindows() {
  Observable<String> subject = Observable.fromArray(new String[] { "zero", "one", "two", "three", "four", "five" });
  Observable<Observable<String>> windowed = subject.window(3, 1);
  List<List<String>> windows = toLists(windowed);
  assertEquals(6, windows.size());
  assertEquals(list("zero", "one", "two"), windows.get(0));
  assertEquals(list("one", "two", "three"), windows.get(1));
  assertEquals(list("two", "three", "four"), windows.get(2));
  assertEquals(list("three", "four", "five"), windows.get(3));
  assertEquals(list("four", "five"), windows.get(4));
  assertEquals(list("five"), windows.get(5));
}
origin: libgdx/libgdx

private void takeSnapshot () {
  mainDependenciesSnapshot.clear();
  for (int i = 0; i < mainDependencies.size(); i++) {
    mainDependenciesSnapshot.add(mainDependencies.get(i));
  }
}
origin: square/okhttp

static String extractStatusLine(Map<String, List<String>> javaResponseHeaders)
  throws ProtocolException {
 List<String> values = javaResponseHeaders.get(null);
 if (values == null || values.size() == 0) {
  // The status line is missing. This suggests a badly behaving cache.
  throw new ProtocolException(
    "CacheResponse is missing a \'null\' header containing the status line. Headers="
      + javaResponseHeaders);
 }
 return values.get(0);
}
origin: ReactiveX/RxJava

@Test
public void testToFutureList() throws InterruptedException, ExecutionException {
  Flowable<String> obs = Flowable.just("one", "two", "three");
  Future<List<String>> f = obs.toList().toFuture();
  assertEquals("one", f.get().get(0));
  assertEquals("two", f.get().get(1));
  assertEquals("three", f.get().get(2));
}
origin: square/okhttp

public static List<String> alpnProtocolNames(List<Protocol> protocols) {
 List<String> names = new ArrayList<>(protocols.size());
 for (int i = 0, size = protocols.size(); i < size; i++) {
  Protocol protocol = protocols.get(i);
  if (protocol == Protocol.HTTP_1_0) continue; // No HTTP/1.0 for ALPN.
  names.add(protocol.toString());
 }
 return names;
}
origin: ReactiveX/RxJava

@Test
public void testOverlappingWindows() {
  Flowable<String> subject = Flowable.fromArray(new String[] { "zero", "one", "two", "three", "four", "five" });
  Flowable<Flowable<String>> windowed = subject.window(3, 1);
  List<List<String>> windows = toLists(windowed);
  assertEquals(6, windows.size());
  assertEquals(list("zero", "one", "two"), windows.get(0));
  assertEquals(list("one", "two", "three"), windows.get(1));
  assertEquals(list("two", "three", "four"), windows.get(2));
  assertEquals(list("three", "four", "five"), windows.get(3));
  assertEquals(list("four", "five"), windows.get(4));
  assertEquals(list("five"), windows.get(5));
}
origin: square/okhttp

private void removeAllCanonicalQueryParameters(String canonicalName) {
 for (int i = encodedQueryNamesAndValues.size() - 2; i >= 0; i -= 2) {
  if (canonicalName.equals(encodedQueryNamesAndValues.get(i))) {
   encodedQueryNamesAndValues.remove(i + 1);
   encodedQueryNamesAndValues.remove(i);
   if (encodedQueryNamesAndValues.isEmpty()) {
    encodedQueryNamesAndValues = null;
    return;
   }
  }
 }
}
origin: spring-projects/spring-framework

@Override
public ResponseSpec onStatus(Predicate<HttpStatus> statusPredicate,
    Function<ClientResponse, Mono<? extends Throwable>> exceptionFunction) {
  if (this.statusHandlers.size() == 1 && this.statusHandlers.get(0) == DEFAULT_STATUS_HANDLER) {
    this.statusHandlers.clear();
  }
  this.statusHandlers.add(new StatusHandler(statusPredicate,
      (clientResponse, request) -> exceptionFunction.apply(clientResponse)));
  return this;
}
origin: spring-projects/spring-framework

protected List<ResourceTransformer> getResourceTransformers() {
  if (this.hasVersionResolver && !this.hasCssLinkTransformer) {
    List<ResourceTransformer> result = new ArrayList<>(this.transformers);
    boolean hasTransformers = !this.transformers.isEmpty();
    boolean hasCaching = hasTransformers && this.transformers.get(0) instanceof CachingResourceTransformer;
    result.add(hasCaching ? 1 : 0, new CssLinkResourceTransformer());
    return result;
  }
  return this.transformers;
}
origin: greenrobot/EventBus

/** Only updates subscriptionsByEventType, not typesBySubscriber! Caller must update typesBySubscriber. */
private void unsubscribeByEventType(Object subscriber, Class<?> eventType) {
  List<Subscription> subscriptions = subscriptionsByEventType.get(eventType);
  if (subscriptions != null) {
    int size = subscriptions.size();
    for (int i = 0; i < size; i++) {
      Subscription subscription = subscriptions.get(i);
      if (subscription.subscriber == subscriber) {
        subscription.active = false;
        subscriptions.remove(i);
        i--;
        size--;
      }
    }
  }
}
origin: square/okhttp

/** Returns the first header named {@code name}, or null if no such header exists. */
public String getHeader(String name) {
 List<String> values = headers.values(name);
 return values.isEmpty() ? null : values.get(0);
}
origin: spring-projects/spring-framework

@Override
public CacheInvocationParameter[] getAllParameters(Object... values) {
  if (this.allParameterDetails.size() != values.length) {
    throw new IllegalStateException("Values mismatch, operation has " +
        this.allParameterDetails.size() + " parameter(s) but got " + values.length + " value(s)");
  }
  List<CacheInvocationParameter> result = new ArrayList<>();
  for (int i = 0; i < this.allParameterDetails.size(); i++) {
    result.add(this.allParameterDetails.get(i).toCacheInvocationParameter(values[i]));
  }
  return result.toArray(new CacheInvocationParameter[0]);
}
origin: ReactiveX/RxJava

@Test
public void testNonOverlappingWindows() {
  Observable<String> subject = Observable.just("one", "two", "three", "four", "five");
  Observable<Observable<String>> windowed = subject.window(3);
  List<List<String>> windows = toLists(windowed);
  assertEquals(2, windows.size());
  assertEquals(list("one", "two", "three"), windows.get(0));
  assertEquals(list("four", "five"), windows.get(1));
}
origin: bumptech/glide

private static boolean memoizeStaticMethodFromArguments(ExecutableElement staticMethod) {
 return staticMethod.getParameters().isEmpty()
   || (staticMethod.getParameters().size() == 1
   && staticMethod.getParameters().get(0).getSimpleName().toString()
   .equals("android.content.Context"));
}
origin: libgdx/libgdx

private void restore () {
  mainDependencies.clear();
  ((ExtensionTableModel)table.getModel()).unselectAll();
  for (int i = 0; i < mainDependenciesSnapshot.size(); i++) {
    mainDependencies.add(mainDependenciesSnapshot.get(i));
    String extensionName = mainDependenciesSnapshot.get(i).getName();
    if (((ExtensionTableModel)table.getModel()).hasExtension(extensionName)) {
      ((ExtensionTableModel)table.getModel()).setSelected(extensionName, true);
    } else {
    }
  }
}
origin: spring-projects/spring-framework

protected List<ResourceTransformer> getResourceTransformers() {
  if (this.hasVersionResolver && !this.hasCssLinkTransformer) {
    List<ResourceTransformer> result = new ArrayList<>(this.transformers);
    boolean hasTransformers = !this.transformers.isEmpty();
    boolean hasCaching = hasTransformers && this.transformers.get(0) instanceof CachingResourceTransformer;
    result.add(hasCaching ? 1 : 0, new CssLinkResourceTransformer());
    return result;
  }
  return this.transformers;
}
java.utilListget

Javadoc

Returns the element at the specified position in this list.

Popular methods of List

  • add
  • size
    Returns the number of elements 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
  • set
    Replaces the element at the specified position in this list with the specified element (optional ope
  • forEach,
  • set,
  • 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.
  • Best IntelliJ plugins
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