Join the Stack Overflow Community
Stack Overflow is a community of 6.4 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

i have an array list that is holding two string arrays.. one dedicated to usernames and another to passwords

    ArrayList<Person> popul = new ArrayList<Person>();
    String[] u = {"Herp","Derp","LOL"};
    String[] p = {"hello123", "qwerty42", "iliketurtles"};

in another class inside the main method i am trying to get the passwords from the popul arrayList to turn into hash.. i have set up a loop to get each password but I do not know how to get only from the password string array and not the username...

for(int x = 0; x < popul.size(); x++){
  popul.get(x);
}

any help is greatly appreciated, thanks

share|improve this question
    
I do not see the connection between popul, people, u and p. Please clarify. – Alp Jun 18 '11 at 22:51
    
please provide a more clear code sample of what you are doing. I do not see how you are using the arrays u or p and there is no declaration of people at all. – Bueller Jun 18 '11 at 22:56
    
sorry, completely screwed up writing the code, mixed some things up.. apologize for the lack of attention – Mike Jun 18 '11 at 23:02

Confusing code, I am assuming you have an arraylist holding 2 String arrays u and p and you want to traverse the passwords array. If that is correct, and if u added u first and p later, your password array can be retrieved by

popul.get(1);

So to traverse the passwords you should be doing

for(String password: popul.get(1))
{
 System.out.println(password);
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.