For example in PhP I would do something like this:
public $hashedpasswords = ;
$this->hashedpasswords[$object->getId()] = $this->getHashedPasscode($object);
First things first. Java is a different language from PHP. Things you need to know regarding to this question is,
strict typed language means you need to define the type of a object when you initializing. Then you can only assign values in the defined type. ie:
int array; //this array expects only integer elements
Therefore, you can't use Java arrays on this purpose.
object oriented languages allows you to define a object (classes in java) and use their instances to work with object's items. Therefore, you don't need to add them into a array. You can directly define an instance of the so called object. ie:
hp = new hashedpassword(); //assign the declared object or declare the object here
If your requirement is to add map key value pairs, you can use maps in Java or you can manually define a keyvaluepair class as in this example.