1. Learn
  2. /
  3. Courses
  4. /
  5. Optimizing Code in Java

Connected

Exercise

Implementing a social network

You're developing a social networking application that needs to analyze potential connections between users. You need to implement a method that generates all possible pairs of users from a list.

Instructions

100 XP
  • For each index i, assign the ith user in elements as the first element of the pair.
  • For each index j, assign the jth user in elements as the second element of the pair.
  • Return the result with all your pairs.