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

How to use
contains
method
in
java.util.ArrayList

Best Java code snippets using java.util.ArrayList.contains (Showing top 20 results out of 19,116)

Refine searchRefine arrow

  • ArrayList.add
  • ArrayList.<init>
  • ArrayList.size
  • ArrayList.get
  • PrintStream.println
  • ArrayList.remove
origin: prestodb/presto

public void addRule(Rule rule) {
  if (!iRules.contains(rule)) {
    iRules.add(rule);
  }
}
origin: pentaho/pentaho-kettle

public void removeMissingTrans( MissingTrans trans ) {
 if ( missingTrans != null && trans != null && missingTrans.contains( trans ) ) {
  missingTrans.remove( trans );
 }
}
origin: lingochamp/FileDownloader

@Override
public BaseDownloadTask addFinishListener(
    final BaseDownloadTask.FinishListener finishListener) {
  if (mFinishListenerList == null) {
    mFinishListenerList = new ArrayList<>();
  }
  if (!mFinishListenerList.contains(finishListener)) {
    mFinishListenerList.add(finishListener);
  }
  return this;
}
origin: nutzam/nutz

/**
 * Context 的获取优先级,以数组的顺序来决定
 * 
 * @param contexts
 */
public ComboContext(IocContext... contexts) {
  ArrayList<IocContext> tmp = new ArrayList<IocContext>(contexts.length);
  for (IocContext iocContext : contexts) {
    if (tmp.contains(iocContext))
      continue;
    if (iocContext instanceof ComboContext){
      ComboContext comboContext = (ComboContext)iocContext;
      for (IocContext iocContext2 : comboContext.contexts) {
        if (tmp.contains(iocContext2))
          continue;
        tmp.add(iocContext2);
      }
    }
    else
      tmp.add(iocContext);
  }
  this.contexts = tmp.toArray(new IocContext[tmp.size()]);
}
origin: org.apache.hadoop/hadoop-common

private void disableExcludedCiphers(SSLEngine sslEngine) {
 String[] cipherSuites = sslEngine.getEnabledCipherSuites();
 ArrayList<String> defaultEnabledCipherSuites =
   new ArrayList<String>(Arrays.asList(cipherSuites));
 Iterator iterator = excludeCiphers.iterator();
 while(iterator.hasNext()) {
  String cipherName = (String)iterator.next();
  if(defaultEnabledCipherSuites.contains(cipherName)) {
   defaultEnabledCipherSuites.remove(cipherName);
   LOG.debug("Disabling cipher suite {}.", cipherName);
  }
 }
 cipherSuites = defaultEnabledCipherSuites.toArray(
   new String[defaultEnabledCipherSuites.size()]);
 sslEngine.setEnabledCipherSuites(cipherSuites);
}
origin: ben-manes/caffeine

/**
 * Values.toArray contains all values
 */
public void testValuesToArray() {
  ConcurrentMap map = map5();
  Collection v = map.values();
  Object[] ar = v.toArray();
  ArrayList s = new ArrayList(Arrays.asList(ar));
  assertEquals(5, ar.length);
  assertTrue(s.contains("A"));
  assertTrue(s.contains("B"));
  assertTrue(s.contains("C"));
  assertTrue(s.contains("D"));
  assertTrue(s.contains("E"));
}
origin: org.drools/drools-compiler

           ResourceType.DRL );
System.out.println( knowledgeBuilder.getErrors().toString() );
KieSession kSession = createKnowledgeSession(kBase);
java.util.ArrayList list = new ArrayList();
kSession.setGlobal( "list",
          list );
kSession.fireAllRules();
assertTrue( list.contains( 84.2 ) );
origin: Sable/soot

 private void graphTraverse(Unit startPoint, InterproceduralCFG<Unit, SootMethod> icfg) {
  List<Unit> currentSuccessors = icfg.getSuccsOf(startPoint);

  if (currentSuccessors.size() == 0) {
   System.out.println("Traversal complete");
   return;
  } else {
   for (Unit succ : currentSuccessors) {
    System.out.println("Succesor: " + succ.toString());
    if (!visited.contains(succ)) {
     dotIcfg.drawEdge(startPoint.toString(), succ.toString());
     visited.add(succ);
     graphTraverse(succ, icfg);

    } else {
     dotIcfg.drawEdge(startPoint.toString(), succ.toString());
    }
   }
  }
 }
}
origin: deathmarine/Luyten

public static void add(String path) {
  if (paths.contains(path)) {
    paths.remove(path);
    paths.add(path);
    return;
  }
  
  if (paths.size() >= 10) paths.remove(0);
  paths.add(path);
  
  save();
}
 
origin: commonsguy/cw-omnibus

void addDevice(BluetoothDevice device) {
 if (isCandidateDevice(device) && !devices.contains(device)) {
  devices.add(device);
  notifyItemInserted(devices.size()-1);
 }
}
origin: seven332/EhViewer

  @Override
  protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
    if (mDoTrick) {
      ArrayList<View> sortedScenes = mSortedScenes;
      if (child == mDumpView) {
        boolean more = false;
        for (int i = 0, n = sortedScenes.size(); i < n; i++) {
          more |= super.drawChild(canvas, sortedScenes.get(i), drawingTime);
        }
        return more;
      } else if (sortedScenes.contains(child)) {
        // Skip
        return false;
      }
    }

    return super.drawChild(canvas, child, drawingTime);
  }
}
origin: robovm/robovm

@Override
void findResources(String name, ArrayList<URL> resources) {
  URL res = findResourceInOwn(name);
  if (res != null && !resources.contains(res)) {
    resources.add(res);
  }
  if (index != null) {
    int pos = name.lastIndexOf("/");
    // only keep the directory part of the resource
    // as index.list only keeps track of directories and root files
    String indexedName = (pos > 0) ? name.substring(0, pos) : name;
    ArrayList<URL> urls = index.get(indexedName);
    if (urls != null) {
      urls.remove(url);
      for (URL url : urls) {
        URLHandler h = getSubHandler(url);
        if (h != null) {
          h.findResources(name, resources);
        }
      }
    }
  }
}
origin: googleapis/google-cloud-java

@Test
public void testListRecordSets() {
 EasyMock.expect(dnsRpcMock.listRecordSets(ZONE_INFO.getName(), EMPTY_RPC_OPTIONS))
   .andReturn(LIST_OF_PB_DNS_RECORDS);
 EasyMock.replay(dnsRpcMock);
 dns = options.getService(); // creates DnsImpl
 Page<RecordSet> dnsPage = dns.listRecordSets(ZONE_INFO.getName());
 assertEquals(2, Lists.newArrayList(dnsPage.getValues()).size());
 assertTrue(Lists.newArrayList(dnsPage.getValues()).contains(DNS_RECORD1));
 assertTrue(Lists.newArrayList(dnsPage.getValues()).contains(DNS_RECORD2));
}
origin: naman14/Timber

public static void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
  PermissionRequest requestResult = new PermissionRequest(requestCode);
  if (permissionRequests.contains(requestResult)) {
    PermissionRequest permissionRequest = permissionRequests.get(permissionRequests.indexOf(requestResult));
    if (verifyPermissions(grantResults)) {
      //Permission has been granted
      permissionRequest.getPermissionCallback().permissionGranted();
    } else {
      permissionRequest.getPermissionCallback().permissionRefused();
    }
    permissionRequests.remove(requestResult);
  }
  refreshMonitoredList();
}
origin: aa112901/remusic

public void cancel(String taskId) {
  if (currentTask != null) {
    if (taskId.equals(currentTask.getId())) {
      currentTask.cancel();
      currentTask.setDownloadStatus(DownloadStatus.DOWNLOAD_STATUS_CANCEL);
    }
  }
  if (prepareTaskList.contains(taskId)) {
    downTaskCount--;
    prepareTaskList.remove(taskId);
  }
  if (prepareTaskList.size() == 0) {
    currentTask = null;
  }
  downFileStore.deleteTask(taskId);
  upDateNotification();
  sendIntent(TASKS_CHANGED);
  L.D(d, TAG, "cancle task = " + taskId);
}
origin: apache/hive

/**
 * Define the connection profile to execute the current statement
 */
String getStatementConnection() {
 if (exec.stmtConnList.contains(exec.conf.defaultConnection)) {
  return exec.conf.defaultConnection;
 }
 else if (!exec.stmtConnList.isEmpty()) {
  return exec.stmtConnList.get(0);
 }
 return exec.conf.defaultConnection;
}

origin: guoguibing/librec

/**
 * Get the continent/country/city list and their corresponding sizes
 */
protected void getLayers() {
  for (String user: hierarchy.keySet()) {
    String continent = hierarchy.get(user).get(0);
    String country = hierarchy.get(user).get(1);
    String city = hierarchy.get(user).get(2);
    if (!continentList.contains(continent)) continentList.add(continent);
    if (!countryList.contains(country)) countryList.add(country);
    if (!cityList.contains(city)) cityList.add(city);
  }
  continentNum = continentList.size();
  countryNum = countryList.size();
  cityNum = cityList.size();
  total_node = continentNum + countryNum + cityNum;
  non_leaf = continentNum + countryNum + 1;
  LOG.info("continentNum: "+ continentNum+"; countryNum: "+countryNum+"; cityNum: "+cityNum);
  LOG.info("total number of nodes: "+total_node + "; the number of non_leaf nodes: "+ non_leaf);
}
origin: stackoverflow.com

 public boolean hasImageCaptureBug() {

  // list of known devices that have the bug
  ArrayList<String> devices = new ArrayList<String>();
  devices.add("android-devphone1/dream_devphone/dream");
  devices.add("generic/sdk/generic");
  devices.add("vodafone/vfpioneer/sapphire");
  devices.add("tmobile/kila/dream");
  devices.add("verizon/voles/sholes");
  devices.add("google_ion/google_ion/sapphire");

  return devices.contains(android.os.Build.BRAND + "/" + android.os.Build.PRODUCT + "/"
      + android.os.Build.DEVICE);

}
origin: oblac/jodd

@Test
void testUseProfiles_withTwoDifferentValues() throws Exception {
  //given
  Vtor vtor = new Vtor();
  vtor.useProfiles("testProfile1", "testProfile2");
  assertEquals(2, vtor.enabledProfiles.size());
  ArrayList<String> enabledProfileList = new ArrayList<>(vtor.enabledProfiles);
  assertTrue(enabledProfileList.contains("testProfile1"), "first element must be equal to first added profile");
  assertTrue(enabledProfileList.contains("testProfile2"), "second element must be equal to second added profile");
  //when
  vtor.useProfile(null);
  //then
  assertEquals(2, vtor.enabledProfiles.size());
}
origin: wangdan/AisenWeiBo

  private void onPictureSelectedChange(String path) {
    if (!selectedFile.contains(path)) {
      if (selectedFile.size() >= maxSize) {
        showMessage(String.format("最多只能选%d张相片", maxSize));
        return;
      }

      selectedFile.add(path);
    }
    else
      selectedFile.remove(path);

    getAdapter().notifyDataSetChanged();
    getActivity().invalidateOptionsMenu();
//        btnCounter.setVisibility(selectedFile.size() == 0 ? View.GONE : View.VISIBLE);
//        txtCounter.setText(String.format("预览(%d/%d)", selectedFile.size(), maxSize));
  }

java.utilArrayListcontains

Javadoc

Searches this ArrayList for the specified object.

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.
  • isEmpty
    Returns true if this list contains no elements.
  • iterator
    Returns an iterator over the elements in this list in proper sequence.The returned iterator is fail-
  • 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 Vim 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