1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
just olya [345]
3 years ago
12

Write a statement to create a Google Guava Multimap instance which contains student ids as keys and the associated values are st

udent profiles.
Computers and Technology
1 answer:
Sergeu [11.5K]3 years ago
8 0

Answer: provided in the explanation section

Explanation:

Note: take note for indentation so as to prevent error.

So we import com.google.common.collect.Multimap;

import java.util.Collection;

import java.util.Map;

class Main {

   public static void main(String[] args) {

       // key as studentId and List of Profile as value.

       Multimap<String,Profile> multimap = ArrayListMultimap.create();

       multimap.put("id1", new ExamProfile("examStudentId1"));

       multimap.put("id1", new ELearningProfile("userId1"));

       multimap.put("id2", new ExamProfile("examStudentId2"));

       multimap.put("id2", new ELearningProfile("userId2"));

       // print the data now.

       for (Map.Entry<String, Collection<Profile>> entry : multimap.entrySet()) {

           String key = entry.getKey();

           Collection<String> value =  multimap.get(key);

           System.out.println(key + ":" + value);

       }

   }

}

// assuming String as the studentId.

// assuming Profile as the interface. And Profile can multiple implementations that would be

// specific to student.

interface Profile {

}

class ExamProfile implements Profile {

   private String examStudentId;

   public ExamProfile(String examStudentId) {

       this.examStudentId = examStudentId;

   }

}

class ELearningProfile implements Profile {

   private String userId;

   public ELearningProfile(String userId) {

       this.userId = userId;

   }

}

This code is able to iterate through all entries in the Google Guava multimap and display all the students name in the associated students profile.

You might be interested in
A network administrator is examining a RIPv2 routing table and notices that several subnets are advertised in individual entries
Aleonysh [2.5K]

Answer:

B. Use the auto-summary command.

Explanation:

With the implementation of dynamic routing protocols, RIP summarizes networks at classful boundaries by default. To configure a router to automatically summarize networks, the auto-summary command would be used.

5 0
3 years ago
Helllp me you will git 16 points
siniylev [52]

Answer:

False

Hope it helps...

Have a great day :P

8 0
2 years ago
Read 2 more answers
Explain why a sound background in auto electricity and electronics is absolutely necessary if you are to troubleshoot
Fynjy0 [20]

the electrical system important for starting up your vehicle, but it is also important for keeping your vehicle running as you drive it. In addition, it is the electrical system that is also responsible for the functioning of things such as your headlights, your radio, and your dashboard

4 0
2 years ago
​The US-CERT newsletter has alerted you about vulnerabilities in some software installed in your organization. To detect if ther
NISA [10]

Answer:

Knowledge-based intrusion detection system.

8 0
3 years ago
When creating a mail merge, you must insert all of the items from your data source into your merged document. Truth or false ?
ElenaW [278]
True <----------------
3 0
2 years ago
Read 2 more answers
Other questions:
  • When the tcp\ip translates a network layer address into a data link layer address (after not finding an entry for the network la
    13·1 answer
  • If a function needs to return more than one value, as a rule of good programming style, you should change it to a(n) ___________
    6·1 answer
  • The area of a square is stored in a double variable named area. Write an expression whose value is length of the diagonal of the
    6·1 answer
  • Can someone that been helping me answer one more question for please and thx
    13·1 answer
  • In this scenario, hackers launch cyber-attacks that affect several parts of the nationâs financial infrastructure over the cours
    8·1 answer
  • Complete the below method, isPalindrome(), that takes in a String and returns a boolean. The boolean should be true if the Strin
    7·1 answer
  • Write two examples of hard copy output?​
    9·1 answer
  • Historically, storytelling passed down the most important ideas about life, family, and society from generation to generation; t
    10·2 answers
  • HELP
    11·1 answer
  • 6
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!