Tabnine Logo
ArrayList.isEmpty
Code IndexAdd Tabnine to your IDE (free)

How to use
isEmpty
method
in
java.util.ArrayList

Best Java code snippets using java.util.ArrayList.isEmpty (Showing top 20 results out of 25,614)

Refine searchRefine arrow

  • ArrayList.add
  • ArrayList.size
  • ArrayList.get
  • Iterator.hasNext
  • Iterator.next
  • ArrayList.remove
  • ArrayList.<init>
  • ArrayList.toArray
origin: google/ExoPlayer

private void updateLastReportedPlayingMediaPeriod() {
 if (!mediaPeriodInfoQueue.isEmpty()) {
  lastReportedPlayingMediaPeriod = mediaPeriodInfoQueue.get(0);
 }
}
origin: lingochamp/FileDownloader

@Override
public void taskWorkFine(BaseDownloadTask.IRunningTask task) {
  if (!mWaitingList.isEmpty()) {
    synchronized (mWaitingList) {
      mWaitingList.remove(task);
    }
  }
}
origin: google/ExoPlayer

/**
 * Returns the {@link MediaPeriodInfo} of the media period at the end of the queue which is
 * currently loading or will be the next one loading. May be null, if no media period is active
 * yet.
 */
public @Nullable MediaPeriodInfo getLoadingMediaPeriod() {
 return mediaPeriodInfoQueue.isEmpty()
   ? null
   : mediaPeriodInfoQueue.get(mediaPeriodInfoQueue.size() - 1);
}
origin: wildfly/wildfly

public SaslClient createSaslClient(final String[] mechanisms, final String authorizationId, final String protocol, final String serverName, final Map<String, ?> props, final CallbackHandler cbh) throws SaslException {
  return delegate.createSaslClient(mechanisms, authorizationId, protocol, serverName, props, callbacks -> {
    ArrayList<Callback> list = new ArrayList<>(Arrays.asList(callbacks));
    final Iterator<Callback> iterator = list.iterator();
    while (iterator.hasNext()) {
      Callback callback = iterator.next();
      if (callback instanceof ChannelBindingCallback) {
        ((ChannelBindingCallback) callback).setBindingType(bindingType);
        ((ChannelBindingCallback) callback).setBindingData(bindingData);
        iterator.remove();
      }
    }
    if (!list.isEmpty()) {
      cbh.handle(list.toArray(new Callback[list.size()]));
    }
  });
}
origin: google/ExoPlayer

@Override
public void onPositionDiscontinuity(@Player.DiscontinuityReason int reason) {
 discontinuityReasons.add(reason);
 int currentIndex = player.getCurrentPeriodIndex();
 if (reason == Player.DISCONTINUITY_REASON_PERIOD_TRANSITION
   || periodIndices.isEmpty()
   || periodIndices.get(periodIndices.size() - 1) != currentIndex) {
  // Ignore seek or internal discontinuities within a period.
  periodIndices.add(currentIndex);
 }
}
origin: apache/activemq

public void recover(ConnectionContext context, Topic topic, SubscriptionRecovery sub) throws Exception {
  // Re-dispatch the messages from the buffer.
  ArrayList<TimestampWrapper> copy = new ArrayList<TimestampWrapper>(buffer);
  if (!copy.isEmpty()) {
    for (Iterator<TimestampWrapper> iter = copy.iterator(); iter.hasNext();) {
      TimestampWrapper timestampWrapper = iter.next();
      MessageReference message = timestampWrapper.message;
      sub.addRecoveredMessage(context, message);
    }
  }
}

origin: pentaho/pentaho-kettle

public static String[] getNodeElements( Node node ) {
 ArrayList<String> elements = new ArrayList<String>(); // List of String
 NodeList nodeList = node.getChildNodes();
 if ( nodeList == null ) {
  return null;
 }
 for ( int i = 0; i < nodeList.getLength(); i++ ) {
  String nodeName = nodeList.item( i ).getNodeName();
  if ( elements.indexOf( nodeName ) < 0 ) {
   elements.add( nodeName );
  }
 }
 if ( elements.isEmpty() ) {
  return null;
 }
 return elements.toArray( new String[ elements.size() ] );
}
origin: andkulikov/Transitions-Everywhere

/**
 * Ends all pending and ongoing transitions on the specified scene root.
 *
 * @param sceneRoot The root of the View hierarchy to end transitions on.
 */
public static void endTransitions(final @NonNull ViewGroup sceneRoot) {
  sPendingTransitions.remove(sceneRoot);
  final ArrayList<Transition> runningTransitions = getRunningTransitions(sceneRoot);
  if (!runningTransitions.isEmpty()) {
    // Make a copy in case this is called by an onTransitionEnd listener
    ArrayList<Transition> copy = new ArrayList(runningTransitions);
    for (int i = copy.size() - 1; i >= 0; i--) {
      final Transition transition = copy.get(i);
      transition.forceToEnd(sceneRoot);
    }
  }
}
origin: apache/hbase

@Override
public List<byte[]> getStripeBoundaries() {
 if (this.state.stripeFiles.isEmpty()) {
  return Collections.emptyList();
 }
 ArrayList<byte[]> result = new ArrayList<>(this.state.stripeEndRows.length + 2);
 result.add(OPEN_KEY);
 Collections.addAll(result, this.state.stripeEndRows);
 result.add(OPEN_KEY);
 return result;
}
origin: apache/flink

@Override
protected void verifyResultsIdealCircumstances(ListSink sink) {
  ArrayList<Integer> list = new ArrayList<>();
  for (int x = 1; x <= 60; x++) {
    list.add(x);
  }
  for (Integer i : sink.values) {
    list.remove(i);
  }
  Assert.assertTrue("The following ID's where not found in the result list: " + list.toString(), list.isEmpty());
  Assert.assertTrue("The sink emitted to many values: " + (sink.values.size() - 60), sink.values.size() == 60);
}
origin: Sable/soot

/**
 * @apilevel internal
 */
private boolean isDUafterReachedFinallyBlocks_compute(Variable v) {
 if(!isDUbefore(v) && finallyList().isEmpty())
  return false;
 for(Iterator iter = finallyList().iterator(); iter.hasNext(); ) {
  FinallyHost f = (FinallyHost)iter.next();
  if(!f.isDUafterFinally(v))
   return false;
 }
 return true;
}
protected java.util.Map isDAafterReachedFinallyBlocks_Variable_values;
origin: libgdx/libgdx

public GradientPanel (GradientColorValue value, String name, String description, boolean hideGradientEditor) {
  super(value, name, description);
  this.value = value;
  initializeComponents();
  if (hideGradientEditor) {
    gradientEditor.setVisible(false);
  }
  gradientEditor.percentages.clear();
  for (float percent : value.getTimeline())
    gradientEditor.percentages.add(percent);
  gradientEditor.colors.clear();
  float[] colors = value.getColors();
  for (int i = 0; i < colors.length;) {
    float r = colors[i++];
    float g = colors[i++];
    float b = colors[i++];
    gradientEditor.colors.add(new Color(r, g, b));
  }
  if (gradientEditor.colors.isEmpty() || gradientEditor.percentages.isEmpty()) {
    gradientEditor.percentages.clear();
    gradientEditor.percentages.add(0f);
    gradientEditor.percentages.add(1f);
    gradientEditor.colors.clear();
    gradientEditor.colors.add(Color.white);
  }
  setColor(gradientEditor.colors.get(0));
}
origin: btraceio/btrace

  void popEnableBit() {
    if (enabledBits.isEmpty()) {
      System.err.println("WARNING: mismatched #ifdef/endif pairs");
      return;
    }
    enabledBits.remove(enabledBits.size() - 1);
    --debugPrintIndentLevel;
    //debugPrint(false, "POP_ENABLED, NOW: " + enabled());
  }
}
origin: Sable/soot

/**
 * @apilevel internal
 */
private boolean inSynchronizedBlock_compute() {  return !finallyList().isEmpty() && finallyList().iterator().next() instanceof SynchronizedStmt;  }
/**
origin: crazycodeboy/TakePhoto

@Override
public void compress() {
  if (images == null || images.isEmpty()) {
    listener.onCompressFailed(images, " images is null");
    return;
  }
  for (TImage image : images) {
    if (image == null) {
      listener.onCompressFailed(images, " There are pictures of compress  is null.");
      return;
    }
    files.add(new File(image.getOriginalPath()));
  }
  if (images.size() == 1) {
    compressOne();
  } else {
    compressMulti();
  }
}
origin: wildfly/wildfly

private static InterceptorList ofList(final ArrayList<EJBClientInterceptorInformation> value) {
  if (value.isEmpty()) {
    return EMPTY;
  } else if (value.size() == 1) {
    return value.get(0).getSingletonList();
  } else {
    return new InterceptorList(value.toArray(EJBClientInterceptorInformation.NO_INTERCEPTORS));
  }
}
origin: apache/storm

/**
 * Add a named argument.
 * @param name the name of the argument.
 * @param parse an optional function to transform the string to something else. If null a NOOP is used.
 * @param assoc an association command to decide what to do if the argument appears multiple times.  If null INTO_LIST is used.
 * @return a builder to be used to continue creating the command line.
 */
public CLIBuilder arg(String name, Parse parse, Assoc assoc) {
  if (!optionalArgs.isEmpty()) {
    throw new IllegalStateException("Cannot have a required argument after adding in an optional argument");
  }
  args.add(new Arg(name, parse, assoc));
  return this;
}
origin: go-lang-plugin-org/go-lang-idea-plugin

 @NotNull
 @Override
 public AnAction[] getChildren(@Nullable AnActionEvent e) {
  if (e == null) {
   return AnAction.EMPTY_ARRAY;
  }
  Project project = e.getProject();
  Editor editor = e.getData(CommonDataKeys.EDITOR);
  if (project == null || editor == null) return AnAction.EMPTY_ARRAY;
  PsiFile file = PsiUtilBase.getPsiFileInEditor(editor, project);

  ArrayList<AnAction> children = ContainerUtil.newArrayList();
  for (GoTestFramework framework : GoTestFramework.all()) {
   if (framework.isAvailableOnFile(file)) {
    children.addAll(framework.getGenerateMethodActions());
   }
  }
  return !children.isEmpty() ? children.toArray(new AnAction[children.size()]) : AnAction.EMPTY_ARRAY;
 }
}
origin: eclipse-vertx/vert.x

if (!extensionHandshakers.isEmpty()) {
 p.addBefore("handler", "websocketsExtensionsHandler", new WebSocketClientExtensionHandler(
  extensionHandshakers.toArray(new WebSocketClientExtensionHandshaker[extensionHandshakers.size()])));
handshaker = WebSocketClientHandshakerFactory.newHandshaker(wsuri, version, subProtocols, !extensionHandshakers.isEmpty(),
                              nettyHeaders, maxWebSocketFrameSize,!options.isSendUnmaskedFrames(),false);
origin: google/ExoPlayer

/**
 * Updates the queue with a released media period. Returns whether the media period was still in
 * the queue.
 */
public boolean onMediaPeriodReleased(MediaPeriodId mediaPeriodId) {
 MediaPeriodInfo mediaPeriodInfo = mediaPeriodIdToInfo.remove(mediaPeriodId);
 if (mediaPeriodInfo == null) {
  // The media period has already been removed from the queue in resetForNewMediaSource().
  return false;
 }
 mediaPeriodInfoQueue.remove(mediaPeriodInfo);
 if (readingMediaPeriod != null && mediaPeriodId.equals(readingMediaPeriod.mediaPeriodId)) {
  readingMediaPeriod = mediaPeriodInfoQueue.isEmpty() ? null : mediaPeriodInfoQueue.get(0);
 }
 return true;
}
java.utilArrayListisEmpty

Javadoc

Returns true if this list contains no elements.

Popular methods of ArrayList

  • <init>
  • add
  • size
    Returns the number of elements in this ArrayList.
  • get
    Returns the element at the specified position in this list.
  • toArray
    Returns an array containing all of the elements in this list in proper sequence (from first to last
  • addAll
    Adds the objects in the specified collection to this ArrayList.
  • remove
    Removes the first occurrence of the specified element from this list, if it is present. If the list
  • clear
    Removes all elements from this ArrayList, leaving it empty.
  • iterator
    Returns an iterator over the elements in this list in proper sequence.The returned iterator is fail-
  • contains
    Searches this ArrayList for the specified object.
  • set
    Replaces the element at the specified position in this list with the specified element.
  • indexOf
    Returns the index of the first occurrence of the specified element in this list, or -1 if this list
  • set,
  • indexOf,
  • clone,
  • subList,
  • stream,
  • ensureCapacity,
  • trimToSize,
  • removeAll,
  • toString

Popular in Java

  • Start an intent from android
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getExternalFilesDir (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Top Sublime Text 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