arrays contains methof

Solutions on MaxInterview for arrays contains methof by the best coders in the world

showing results for - "arrays contains methof"
Abia
12 Mar 2017
1package com.mkyong.core;
2
3import java.util.Arrays;
4import java.util.List;
5
6public class StringArrayExample1 {
7
8    public static void main(String[] args) {
9
10        String[] alphabet = new String[]{"A", "B", "C"};
11
12        // Convert String Array to List
13        List<String> list = Arrays.asList(alphabet);
14        
15        if(list.contains("A")){
16            System.out.println("Hello A");
17        }
18
19    }
20
21}
22Copy
Raphael
30 Apr 2018
1	// Convert to stream and test it
2	boolean result = Arrays.stream(alphabet).anyMatch("A"::equals);
3	if (result) {
4		System.out.println("Hello A");
5	}
6Copy
Louane
30 Nov 2020
1private static final Set<String> VALUES = Set.of(
2    "AB","BC","CD","AE"
3);
4
similar questions
queries leading to this page
arrays contains methof