Java Array Index Of indexOfCS(String[] strings, String a)

Here you can find the source of indexOfCS(String[] strings, String a)

Description

index Of CS

License

Open Source License

Declaration

public static int indexOfCS(String[] strings, String a) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.List;

public class Main {
    public static final int NOT_FOUND = -1;

    public static int indexOfCS(String[] strings, String a) {
        for (int i = 0; i < strings.length; i++) {
            if (strings[i].equals(a))
                return i;
        }/*from w w  w .  j  ava 2s.c  o  m*/
        return NOT_FOUND;
    }

    public static int indexOfCS(List<String> strings, String a) {
        int i = 0;
        for (String b : strings) {
            if (b.equals(a))
                return i;
            i++;
        }
        return NOT_FOUND;
    }
}

Related

  1. indexOf(int[] arr, int e)
  2. indexOf(int[] arr, int val)
  3. indexOf(Object[] array, Object objectToFind)
  4. indexOf(Object[] array, Object objectToFind)
  5. indexOf(Object[] elements, Object value)
  6. indexOfIdentical(Object[] array, Object value)