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]
4 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]4 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
Compare pseudocode and flowcharts for designing computer programs, and discuss the advantages and disadvantages of each.
Zarrin [17]

Answer:

<h2 /><h2>Pseudocode</h2>

<h3>Advantages of Pseudocode:</h3>
  • Easier to translate into a high level programming language
  • No pressure of syntax (grammar) of the coding
  • Partially resembles standard English so it's easier for programmers to understand

<h3>Disadvantages of Pseudocode:</h3>
  • Can't immediately spot errors in coding such as logic errors
  • Runtime errors don't exist in Pseudocode

<h2>Flowcharts</h2><h3 /><h3>Advantages of Flowcharts</h3>
  • Focuses on the logic of the program
  • Displays the manipulation (and flow) of data easily

<h3>Disadvantages of Flowcharts</h3>
  • Not ideal for big programs (only for subprograms)
  • Shapes may not be clear or obvious to what they are in terms of their functions
8 0
4 years ago
Is doing free lancing from age 16 good or bad?​
Art [367]

Answer:

I think it's good. It will serve as an experience for you. Having experience at an early age is better as you could be at your best before you go into the field that you want. Plus free lancing wouldnt tie you down, gives you more freedom. And extra income(?). ^^

8 0
2 years ago
Antonio’s computer is hung up. which trio of keys should he press to restart his computer?
IgorLugansk [536]

Ctrl + Alt + Delete is the keys used by some PCs to reboot frozen computers by using task manager to kill any nonresponding applications. Another way to do this on some other is Ctrl + Shift + Esc.

6 0
3 years ago
Read 2 more answers
A new company has proposed a number of different cache layouts for their system and you’ve
jonny [76]

Answer:

66 bytes, 50 bytes and 27 bytes

Explanation:

Cache can be defined as an area or type of computer memory in which information that is often in use can be stored temporarily and got to especially quickly.

It's a hardware or software that is used to store something, usually data, temporarily in a computing environment.

See attachment for a step by step solution to the questions.

4 0
3 years ago
Which of the selections below does not represent a workable ip address?
defon

Answer: C

Explanation:

Because ipv4 ip addresses will be 4 sets of numbers for a maximum of 255 per set ie.  The highest ipv4 number is 255.255.255.255 and the answer C has 293 in it.

6 0
4 years ago
Other questions:
  • What is the bandwidth-delay product for a 50 Mbps channel on a geostationary satellite (assume a RTT of 540 ms)? If the packets
    5·1 answer
  • What cable should i be using to connect my android tablet to the pc?
    13·2 answers
  • If I want to have an estimate of the number of people who visited my website, which metric should I use?
    5·2 answers
  • How to allow all users to access a program?
    12·1 answer
  • Which of the following is a device that plugs in a usb port on the computer or mobile device and contains multiple usb ports?
    9·1 answer
  • How to share pictures on brainy ​
    8·1 answer
  • "The ______ of an operational system that supports an organization includes policies, requirements, and conditional statements t
    13·1 answer
  • Decimal numbers is equivalent to binary 110
    5·1 answer
  • How did Avery and Garth most likely create their
    13·1 answer
  • Jason is playing a game in which players must maneuver around changing barriers
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!