By providing a public method to access a value in the array rather than the array itself, the client has no clue how the data is stored and thus the ArrayList is encapsulated: the client doesn't care...
Type: Posts; User: copeg
By providing a public method to access a value in the array rather than the array itself, the client has no clue how the data is stored and thus the ArrayList is encapsulated: the client doesn't care...
If I understand your question correctly, you don't want to have a method with returns the full arraylist for fear of that class modifying the list, but without it how can another class access its...