import java.util.*;
class Main {
public static void main
(String[] args
) { ArrayList<String> posicoes = new ArrayList<String>();
posicoes.add("Ricardo;01051509912;gmail");
posicoes.add("Renato;123456789123;hotmail");
posicoes.add("Rodrigo;09873923121;yahoo");
System.
out.
println(BuscaString
(posicoes,
"01051509912")); System.
out.
println(BuscaString
(posicoes,
"123456789123")); }
public static int BuscaString
(ArrayList
<String
> lista,
String busca
) { for (int i = 0; i < lista.size(); i++) if (lista.get(i).contains(busca)) return i;
return -1;
}
}
//https://pt.stackoverflow.com/q/233378/101
aW1wb3J0IGphdmEudXRpbC4qOwoKY2xhc3MgTWFpbiB7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgewoJCSAgICBBcnJheUxpc3Q8U3RyaW5nPiBwb3NpY29lcyA9IG5ldyBBcnJheUxpc3Q8U3RyaW5nPigpOwoJCSAgICBwb3NpY29lcy5hZGQoIlJpY2FyZG87MDEwNTE1MDk5MTI7Z21haWwiKTsKCQkgICAgcG9zaWNvZXMuYWRkKCJSZW5hdG87MTIzNDU2Nzg5MTIzO2hvdG1haWwiKTsKCQkgICAgcG9zaWNvZXMuYWRkKCJSb2RyaWdvOzA5ODczOTIzMTIxO3lhaG9vIik7CgkJICAgIFN5c3RlbS5vdXQucHJpbnRsbihCdXNjYVN0cmluZyhwb3NpY29lcywgIjAxMDUxNTA5OTEyIikpOwoJCSAgICBTeXN0ZW0ub3V0LnByaW50bG4oQnVzY2FTdHJpbmcocG9zaWNvZXMsICIxMjM0NTY3ODkxMjMiKSk7Cgl9CglwdWJsaWMgc3RhdGljIGludCBCdXNjYVN0cmluZyhBcnJheUxpc3Q8U3RyaW5nPiBsaXN0YSwgU3RyaW5nIGJ1c2NhKSB7CgkgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsaXN0YS5zaXplKCk7IGkrKykgaWYgKGxpc3RhLmdldChpKS5jb250YWlucyhidXNjYSkpIHJldHVybiBpOwoJCXJldHVybiAtMTsKCX0KfQoKLy9odHRwczovL3B0LnN0YWNrb3ZlcmZsb3cuY29tL3EvMjMzMzc4LzEwMQ==