There is a variable

Collection<Socket> UsersMessage; 

Which is obtained from the card

 UsersMessage = onlineUsers.get(username); 

How can you invert a loop so that it first displays the latest values ​​using such a loop?

  for (Socket test2222 : UsersMessage) { } 

    1 answer 1

    1. Create an ArrayList using copy constructor
    2. create a ListIterator using this ArrayList. (call the iterator methods manually.)
    3. ...
    4. PROFIT