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
What is a safe practice when online?
lisabon 2012 [21]

Answer:

Safe work practices are generally written methods outlining how to perform a task with minimum risk to people, equipment, materials, environment, and processes

Explanation:

6 0
2 years ago
Implement the following functions def normalize(input_string): input: a string of text characters. Each character is called a to
Crank

Answer:

  1. def normalize(input_string):
  2.    output = []
  3.    for c in input_string:
  4.        if(c.isalpha()):
  5.            output.append(c.lower())
  6.    
  7.    return output
  8.    
  9. print(normalize("O.K. #1 Python!"))

Explanation:

Firstly, create a function normalize that takes one input string (Line 1).

Next, we create an empty list and assign it to output variable (Line 2). This list will hold all the letters from the input string.

Create a for loop to traverse each of the character in the input string (Line 4) and then use isalpha() method to check if the current character is a letter (Line 5). If so, add the letter to output list (Line 6). Please note we can convert the letter to lowercase using lower() method.

After completing the loop, return the output list (Line 8).

We can test the function using the sample input given in the question (Line 10) and we shall get ['o', 'k', 'p', 'y', 't', 'h', 'o', 'n']

6 0
3 years ago
Heather wants a transition effect applied to the links in the gameLinks list in which a gradient-colored bar gradually expands u
Usimov [2.4K]

Answer:

Hi there Zelenky! This is a good question to practice style sheets and effects. Please find my answer below.

Explanation:

Below CSS contains the code to answer all parts of the question.

nav#gameLinks a::after {  

 content: ‘’;  

 top: 100%;  

 left: 0px;  

 width: 0%;  

 height: 8px;  

 position: absolute;  

 background: -webkit-gradient(linear, right, left, from(rgb(237, 243, 71)), to(rgb(188, 74, 0));  

 border-radius: 4px;  

 opacity: 0;

}

8 0
3 years ago
In today's world, both government and the private sector are struggling to provide a secure, efficient, timely, and separate mea
mariarad [96]

Answer:

Cyber-resilience

Explanation:

Reduce potential vulnerabilities:

  • Cyber-resilience (term more recent than cyber-security) refers to the capacity or attribute of systems, entities, organizations, critical infrastructure (electricity, water, transportation, communications and financial services).
  • Cyber-resilience helps organizations / businesses recognize that attackers can succeed in their attempts, forcing them to think differently and be more agile.
5 0
3 years ago
The best protection from an explosive device is: (1 point)
Juliette [100K]
<span>The best protection from an explosive device is:
</span>
<span>b. protective clothing</span>
6 0
3 years ago
Other questions:
  • Write a program totake a depth (in kilometers) inside the earth as input data;compute
    15·1 answer
  • Use a colon before a list and put one space after a colon. True False
    15·2 answers
  • In the Remote Access Domain, if private data or confidential data is compromised remotely, you should set automatic blocking for
    5·1 answer
  • class student_record { public: int age; string name; double gpa; }; Implement a void function that has five formal parameters: a
    15·1 answer
  • Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 te
    13·1 answer
  • To distinguish advertising, which typically is conveyed via print, TV, radio, the Internet, etc., from person-to-person forms of
    5·2 answers
  • Which range of values would result in 10 elements stored in an array?
    13·1 answer
  • Explain the uses of computer in police department​
    13·2 answers
  • How do i block somebody on here, theyre making me have a panic attack. /srs
    11·2 answers
  • Explain four features of presentation packages​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!