Last active
December 24, 2015 13:19
-
-
Save evilnapsis/6803632 to your computer and use it in GitHub Desktop.
SearchNum Clase para buscar numeros o caracteres repetidos dentro de un array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Clase para buscar numeros o caracteres repetidos dentro de un array | |
* http://gist.github.com/evinapsis/6803632 | |
*/ | |
import java.util.ArrayList; | |
/** | |
* @author evilnapsis | |
*/ | |
public class SearchNum { | |
public static ArrayList<String> list; | |
public static void init(){ | |
list = new ArrayList<String>(); | |
} | |
public static void add(String item){ | |
list.add(item); | |
} | |
public static boolean ifExist(String item){ | |
boolean f = false; | |
if(!isEmpty()){ | |
Object[] all = list.toArray(); | |
int l = all.length; | |
for(int i=0;i<l;i++){ | |
if(all[i].toString().equals(item)){ f = true; break;} | |
} | |
} | |
return f; | |
} | |
public static boolean isEmpty(){ | |
Object[] all = list.toArray(); | |
if(all.length==0){ return true; } | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment