Answers for "java arraylist contains"

1

ArrayList contains(Object o) method in java

import java.util.ArrayList;
public class ArrayListContainsMethodExample
{
   public static void main(String[] args)
   {
      ArrayList<String> names = new ArrayList<String>(5);
      names.add("virat");
      names.add("dhoni");
      names.add("rohit");
      names.add("vijay");
      names.add("ajay");
      System.out.println("Names: " + names);
      System.out.print("Does list contains name dhoni?: ");
      System.out.println(names.contains("dhoni"));
      System.out.print("Does list contains name Sudhakar?: ");
      System.out.println(names.contains("Sudhakar"));
   }
}
Posted by: Guest on October-30-2020
0

arraylist contains doc

ArrayList<String> strings=new ArrayList<String>();
boolean ans = arr.contains("geeks");		//ans=false
Posted by: Guest on March-11-2021
0

list contains

List<Integer> arr = new ArrayList<Integer>(4);
boolean ans = arr.contains(2);
Posted by: Guest on July-25-2020

Code answers related to "java arraylist contains"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language