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
File-sharing programs such as Napster, Kazaa, and iMesh make it possible for individuals to exchange music files over the Intern
Mashutka [201]

Answer:

Option A) Demand for CDs has decreased, causing equilibrium price and quantity to decrease.

is the correct answer.

Explanation:

  • File-sharing is a common practice nowadays. It helps us by providing access to different files (audio , video, images, documents) to others in a faster way.
  • A wide range of files are shared daily by using different means of file-sharing including computer networks and peer-to-peer networking.
  • Formerly, the data was shared using CDs but now this system has been replaced with the advent of internet.
  • Usage of CDs is dropped drastically and hence their demand is decreased.
  • So now the prices of CDs are not in equilibrium and their quantity is also decreased.

i hope it will help you!

3 0
3 years ago
What are the modes of operation of WLANs?
Nimfa-mama [501]

Answer:

WLAN's or Wireless LAN Units have 2 main modes of operation

Explanation:

The Two Main modes of Operation are the following

<u>Infrastructure Mode:</u> in this mode the main WLAN unit becomes the main connection point in which all devices are connected to and the main unit provides an internet connection to all the devices connected to it.

<u>Ad Hoc Mode:</u> in this mode devices transfer data from one another back and forth without permission from a base unit.

Some WLAN units will also include 2 extra modes of operation called Bridge and Wireless Distribution System (WDS).

<u>Bridge Mode:</u> this mode allows the base unit to act as an intermediary and bridge two different connection points. Such as bridging a wired connection with a wireless one.

<u>WDS Mode:</u> this mode uses various access points to wirelessly interconnect devices to the internet using repeaters to transmit connections. It can provide internet to both wired and wireless clients.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

6 0
3 years ago
I still need help, thank you! Will give Brainliest ​
wlad13 [49]

Answer: 1 what do u think to help u

6 0
3 years ago
Derek needs to shift from his desk to a new work area in his office. Which ergonomic principle should he follow while moving his
Paul [167]

Answer:

One should be in neutral posture, which is the ergonomic principle that needs to be followed while moving our belongings from one location to the other. Its because in this position the work done is zero, and hence we never lose any energy. And this is the posture you should ensure while you are working. Also, the goods packed when moved in this manner, has least chance of wear and tear. Thus, the goods remain safe.

Also, Derek should keep things in a box with padding and then lift to move them to the new work area.

Explanation:

The answer is self explanatory.

3 0
3 years ago
Lottery Number Generator Design a program that generates a 7-digit lottery number. The program should have an Integer array with
Nikolay [14]

Answer:

/******************************************************************************

                             Online C++ Compiler.

              Code, Compile, Run and Debug C++ program online.

Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

#include <string>

#include <sstream>

using namespace std;

bool equal(int sys[],int user[])

{

    for (int i=0;i<7;i++)

{

 if(sys[i]!=user[i]){

     return false;

 }

}

return true;

}

int main()

{

int sys[7];

int user[7];

int min=0

;int max=9;

string userinput;

while(0==0){

for (int i=0;i<7;i++)

{

    sys[i]=rand() % (max - min + 1) + min;

}

cout <<endl;

   cout<<"enter numbers"<<endl;

for (int i=0;i<7;i++)

{

 getline (cin,userinput);

    if(userinput=="x"){

        return 0;

    }

    else{

 stringstream(userinput) >> user[i];

   

    }

}

     cout<<"User number"<<endl;

for (int i=0;i<7;i++)

{

    cout << user[i];

}

    cout<<"system number"<<endl;

for (int i=0;i<7;i++)

{

    cout << sys[i];

}

if(equal(sys,user))

{

   cout<<"You won !"<<endl;

}else {

       cout<<"Try again :("<<endl;

}

}

   return 0;

}

Explanation:

Using c++ rand function generate a random number between 0-9.

Formula for random number is rand (max-min +1)+min.

Run this in a loop for 7 time and store each number to an array index in sys array which is for system generated number.

now using string take input from user and check if input is x close program else use stringstream to parse input string to int and store it in user array. Stringstream is a cpp header file used for parsing and handling of strin g inputs. Run this program in loop for 7 times.

Now create a function of type boolean denoted by "bool". This will take both arr as parameter and check if both are equal or not. It compares eac index of user array against each index of sys array and if both values are not equal returns false.

5 0
3 years ago
Other questions:
  • If you were to conduct an Internet search on vegetarian restaurants, which of the following searches would be the best
    7·1 answer
  • Given positive integer numInsects, write a while loop that prints that number doubled without reaching 100. Follow each number w
    8·1 answer
  • You resurrected an old worksheet. It appears to contain most of the information that you need, but not all of it. Which step sho
    5·1 answer
  • Explain the factors involved in selecting a routing protocol to be used on a network.
    12·1 answer
  • Mkdir() is the command in Java to create a new directory.<br> a) True b) False
    10·1 answer
  • Importance of producing a hardcopy output​
    15·1 answer
  • Why are computers useful for modeling situations?
    13·2 answers
  • Ad identifies and describes at least four ways to prevent downloading of spyware, adware, and viruses to computer
    9·1 answer
  • Which is the purpose of adding B-Roll footage to a sequence?
    10·1 answer
  • Whats the best way to make a video game?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!