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
How do programmers recognise patterns, generalise and abstract information
Dima020 [189]

Answer:

Pattern recognition is the process of recognizing patterns by using machine learning algorithm. ... In a typical pattern recognition application, the raw data is processed and converted into a form that is amenable for a machine to use. Pattern recognition involves classification and cluster of patterns

Explanation:

4 0
3 years ago
The purpose of an Internet _____ is to receive packets and send them along towards their final destination.
Bumek [7]

The tool that receives packets and send them along towards their final destination is; Internet Server

<h3>Internet Servers</h3>

We are told that the tool is used to receive packets and send them along towards their final destination.

  • Now, the tool is an internet server because internet servers are softwares and hardwares that make use of HTTP and other protocols to respond to client requests that are made over the World Wide Web.

Now, the main job of an internet server is to display website content through storing, processing and delivering webpages to the final destination.

Read more about internet server at; brainly.com/question/20602197

7 0
3 years ago
study the picture of the simulation and the graph above. based on the information obtained from your study of the simulation and
andreyandreev [35.5K]
This is how you know i’m def gonna fail my university class this year :/
6 0
2 years ago
What is the value of creating recurring tasks?
scoundrel [369]

Answer:

✔️saves time spent manually creating multiple tasks

Explanation:

I did it on edge

4 0
2 years ago
Read 2 more answers
Which step is first in changing the proofing language of an entire document?
Genrish500 [490]
Select the whole document by pressing Ctrl+a.
7 0
3 years ago
Other questions:
  • Importance of Computer in the world​
    12·2 answers
  • You are contacted by a project organizer for a university computer science fair. The project organizer asks you to hold a forum
    10·1 answer
  • How can a signature be added to an email message? Check all that apply.
    10·2 answers
  • A collection of realated files is called a
    12·1 answer
  • A file name extension provides what information about a file?
    6·1 answer
  • 我对汉语的兴趣 làm đoạn văn theo đề trên​
    14·1 answer
  • Modify the Comments.java program from Programming Exercise 1-10 so at least one of the statements about comments is displayed in
    10·1 answer
  • In an executing process, the program counter points __________.
    15·1 answer
  • What’s cloud-based LinkedIn automation?
    14·1 answer
  • How does links helped a student like you in navigating the different available websites?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!