SlideShare a Scribd company logo
1 of 10
Download to read offline
Java
I'm not sure how to implement this code can someone help me / guide me? thank you
(Updated with PrefixMap interface included at the bottom of the code).
import java.util.List;
import java.util.Map;
public class Storage implements PrefixMap {
private Map keys;
private Map> prefixes;
public Storage() {
// TODO Initialise your maps
}
/*
* How many keys are stored in the map
*/
@Override
public int size() {
// TODO Implement this, then remove this comment
return 0;
}
@Override
public boolean isEmpty() {
// TODO Implement this, then remove this comment
return false;
}
/*
* Get the value corresponding to the key (or null if the key is not found)
* if the key contains any character other than A,C,G,T, throw MalformedKeyException
* if the key is null, throw IllegalArgumentException
*/
@Override
public String get(String key) {
// TODO Implement this, then remove this comment
return null;
}
/*
* Insert the value into the data structure, using the given key. If the key
* already existed, replace and return the old value (otherwise return null)
* if the key contains any character other than A,C,G,T, throw MalformedKeyException
* if the key or value is null, throw IllegalArgumentException
*/
@Override
public String put(String key, String value) {
// TODO Implement this, then remove this comment
return null;
}
/*
* Remove the value corresponding to the given key from the data structure,
* if it exists. Return the old value, or null if no value was found.
* if the key contains any character other than A,C,G,T, throw MalformedKeyException
* if the key is null, throw IllegalArgumentException
*/
@Override
public String remove(String key) {
// TODO Implement this, then remove this comment
return null;
}
/*
* return the number of keys which start with the given prefix if the prefix
* contains any character other than A,C,G,T, throw MalformedKeyException
* if the prefix is null, throw IllegalArgumentException
*/
@Override
public int countKeysMatchingPrefix(String prefix) {
// TODO Implement this, then remove this comment
return 0;
}
/*
* return the collection of keys which start with the given prefix if the
* prefix contains any character other than A,C,G,T, throw MalformedKeyException
* if the prefix is null, throw IllegalArgumentException
*/
@Override
public List getKeysMatchingPrefix(String prefix) {
// TODO Implement this, then remove this comment
return null;
}
/*
* Return the number of unique prefixes
* e.g. if the tree stores keys GAT, GATTC, GATTACA, this method will return 8
* because the possible prefixes are G, GA, GAT, GATT, GATTC, GATTA, GATTAC,
GATTACA
*/
@Override
public int countPrefixes() {
// TODO Implement this, then remove this comment
return 0;
}
/*
* Return the sum of the lengths of all keys
* e.g. if the tree stores keys GAT, GATTC, GATTACA, this method will return 15
*/
@Override
public int sumKeyLengths() {
// TODO Implement this, then remove this comment
return 0;
}
}
import java.util.List;
public interface PrefixMap {
public boolean isEmpty();
/*
* How many keys are stored in the map
*/
public int size();
/*
* Get the value corresponding to the key (or null if the key is not found)
* if the key contains any character other than A,C,G,T, throw MalformedKeyException
* if the key is null, throw IllegalArgumentException
*/
public String get(String key);
/*
* Insert the value into the data structure, using the given key. If the key
* already existed, replace and return the old value (otherwise return null)
* if the key contains any character other than A,C,G,T, throw MalformedKeyException
* if the key or value is null, throw IllegalArgumentException
*/
public String put(String key, String value);
/*
* Remove the value corresponding to the given key from the data structure,
* if it exists. Return the old value, or null if no value was found.
* if the key contains any character other than A,C,G,T, throw MalformedKeyException
* if the key is null, throw IllegalArgumentException
*/
public String remove(String key);
/*
* return the number of keys which start with the given prefix if the prefix
* contains any character other than A,C,G,T, throw MalformedKeyException
* if the prefix is null, throw IllegalArgumentException
*/
public int countKeysMatchingPrefix(String prefix);
/*
* return the collection of keys which start with the given prefix if the
* prefix contains any character other than A,C,G,T, throw MalformedKeyException
* if the prefix is null, throw IllegalArgumentException
*/
public List getKeysMatchingPrefix(String prefix);
/*
* Return the number of unique prefixes
* e.g. if the tree stores keys GAT, GATTC, GATTACA, this method will return 8
* because the possible prefixes are G, GA, GAT, GATT, GATTC, GATTA, GATTAC,
GATTACA
*/
public int countPrefixes();
/*
* Return the sum of the lengths of all keys
* e.g. if the tree stores keys GAT, GATTC, GATTACA, this method will return 15
*/
public int sumKeyLengths();
}
Solution
import java.util.List;
import java.util.Map;
public class Storage implements PrefixMap {
private Map keys;
private Map> prefixes;
public Storage() {
// TODO Initialise your maps
}
/*
* How many keys are stored in the map
*/
@Override
public int size() {
// TODO Implement this, then remove this comment
return 0;
}
@Override
public boolean isEmpty() {
// TODO Implement this, then remove this comment
return false;
}
/*
* Get the value corresponding to the key (or null if the key is not found)
* if the key contains any character other than A,C,G,T, throw MalformedKeyException
* if the key is null, throw IllegalArgumentException
*/
@Override
public String get(String key) {
// TODO Implement this, then remove this comment
return null;
}
/*
* Insert the value into the data structure, using the given key. If the key
* already existed, replace and return the old value (otherwise return null)
* if the key contains any character other than A,C,G,T, throw MalformedKeyException
* if the key or value is null, throw IllegalArgumentException
*/
@Override
public String put(String key, String value) {
// TODO Implement this, then remove this comment
return null;
}
/*
* Remove the value corresponding to the given key from the data structure,
* if it exists. Return the old value, or null if no value was found.
* if the key contains any character other than A,C,G,T, throw MalformedKeyException
* if the key is null, throw IllegalArgumentException
*/
@Override
public String remove(String key) {
// TODO Implement this, then remove this comment
return null;
}
/*
* return the number of keys which start with the given prefix if the prefix
* contains any character other than A,C,G,T, throw MalformedKeyException
* if the prefix is null, throw IllegalArgumentException
*/
@Override
public int countKeysMatchingPrefix(String prefix) {
// TODO Implement this, then remove this comment
return 0;
}
/*
* return the collection of keys which start with the given prefix if the
* prefix contains any character other than A,C,G,T, throw MalformedKeyException
* if the prefix is null, throw IllegalArgumentException
*/
@Override
public List getKeysMatchingPrefix(String prefix) {
// TODO Implement this, then remove this comment
return null;
}
/*
* Return the number of unique prefixes
* e.g. if the tree stores keys GAT, GATTC, GATTACA, this method will return 8
* because the possible prefixes are G, GA, GAT, GATT, GATTC, GATTA, GATTAC,
GATTACA
*/
@Override
public int countPrefixes() {
// TODO Implement this, then remove this comment
return 0;
}
/*
* Return the sum of the lengths of all keys
* e.g. if the tree stores keys GAT, GATTC, GATTACA, this method will return 15
*/
@Override
public int sumKeyLengths() {
// TODO Implement this, then remove this comment
return 0;
}
}
import java.util.List;
public interface PrefixMap {
public boolean isEmpty();
/*
* How many keys are stored in the map
*/
public int size();
/*
* Get the value corresponding to the key (or null if the key is not found)
* if the key contains any character other than A,C,G,T, throw MalformedKeyException
* if the key is null, throw IllegalArgumentException
*/
public String get(String key);
/*
* Insert the value into the data structure, using the given key. If the key
* already existed, replace and return the old value (otherwise return null)
* if the key contains any character other than A,C,G,T, throw MalformedKeyException
* if the key or value is null, throw IllegalArgumentException
*/
public String put(String key, String value);
/*
* Remove the value corresponding to the given key from the data structure,
* if it exists. Return the old value, or null if no value was found.
* if the key contains any character other than A,C,G,T, throw MalformedKeyException
* if the key is null, throw IllegalArgumentException
*/
public String remove(String key);
/*
* return the number of keys which start with the given prefix if the prefix
* contains any character other than A,C,G,T, throw MalformedKeyException
* if the prefix is null, throw IllegalArgumentException
*/
public int countKeysMatchingPrefix(String prefix);
/*
* return the collection of keys which start with the given prefix if the
* prefix contains any character other than A,C,G,T, throw MalformedKeyException
* if the prefix is null, throw IllegalArgumentException
*/
public List getKeysMatchingPrefix(String prefix);
/*
* Return the number of unique prefixes
* e.g. if the tree stores keys GAT, GATTC, GATTACA, this method will return 8
* because the possible prefixes are G, GA, GAT, GATT, GATTC, GATTA, GATTAC,
GATTACA
*/
public int countPrefixes();
/*
* Return the sum of the lengths of all keys
* e.g. if the tree stores keys GAT, GATTC, GATTACA, this method will return 15
*/
public int sumKeyLengths();
}

More Related Content

Similar to JavaIm not sure how to implement this code can someone help me .pdf

New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxNew folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
curwenmichaela
 
StackInterface An interface for the ADT stack. Do not modif.pdf
StackInterface An interface for the ADT stack. Do not modif.pdfStackInterface An interface for the ADT stack. Do not modif.pdf
StackInterface An interface for the ADT stack. Do not modif.pdf
ARCHANASTOREKOTA
 
we using java code DynamicArrayjava Replace all .pdf
we using java code   DynamicArrayjava   Replace all .pdfwe using java code   DynamicArrayjava   Replace all .pdf
we using java code DynamicArrayjava Replace all .pdf
gudduraza28
 
EmptyCollectionException-java -- - Represents the situation in which.docx
EmptyCollectionException-java --  - Represents the situation in which.docxEmptyCollectionException-java --  - Represents the situation in which.docx
EmptyCollectionException-java -- - Represents the situation in which.docx
BlakeSGMHemmingss
 
using the code below write the public V add(K key, V value); that ad.pdf
using the code below write the public V add(K key, V value); that ad.pdfusing the code below write the public V add(K key, V value); that ad.pdf
using the code below write the public V add(K key, V value); that ad.pdf
amirthagiftsmadurai
 
package singlylinkedlist; public class Node { public String valu.pdf
package singlylinkedlist; public class Node { public String valu.pdfpackage singlylinkedlist; public class Node { public String valu.pdf
package singlylinkedlist; public class Node { public String valu.pdf
amazing2001
 
Hello need help on this lab- what you need to do is add a code to Arra.pdf
Hello need help on this lab- what you need to do is add a code to Arra.pdfHello need help on this lab- what you need to do is add a code to Arra.pdf
Hello need help on this lab- what you need to do is add a code to Arra.pdf
Ian0J2Bondo
 
Here is what I got so far, I dont know how to write union, interse.pdf
Here is what I got so far, I dont know how to write union, interse.pdfHere is what I got so far, I dont know how to write union, interse.pdf
Here is what I got so far, I dont know how to write union, interse.pdf
arihantpatna
 
META-INFMANIFEST.MFManifest-Version 1.0.classpath.docx
META-INFMANIFEST.MFManifest-Version 1.0.classpath.docxMETA-INFMANIFEST.MFManifest-Version 1.0.classpath.docx
META-INFMANIFEST.MFManifest-Version 1.0.classpath.docx
andreecapon
 
Hi, Please find my code.I have correted all of your classes.Plea.pdf
Hi, Please find my code.I have correted all of your classes.Plea.pdfHi, Please find my code.I have correted all of your classes.Plea.pdf
Hi, Please find my code.I have correted all of your classes.Plea.pdf
pritikulkarni20
 
java question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdfjava question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdf
dbrienmhompsonkath75
 
How do I fix this error - Exception in thread -main- java-lang-NullPoi.pdf
How do I fix this error - Exception in thread -main- java-lang-NullPoi.pdfHow do I fix this error - Exception in thread -main- java-lang-NullPoi.pdf
How do I fix this error - Exception in thread -main- java-lang-NullPoi.pdf
pnaran46
 
mainpublic class AssignmentThree {    public static void ma.pdf
mainpublic class AssignmentThree {    public static void ma.pdfmainpublic class AssignmentThree {    public static void ma.pdf
mainpublic class AssignmentThree {    public static void ma.pdf
fathimafancyjeweller
 
in this assignment you are asked to write a simple driver program an.pdf
in this assignment you are asked to write a simple driver program an.pdfin this assignment you are asked to write a simple driver program an.pdf
in this assignment you are asked to write a simple driver program an.pdf
michardsonkhaicarr37
 
How to fix this error- Exception in thread -main- q- Exit java-lang-.pdf
How to fix this error-   Exception in thread -main- q- Exit java-lang-.pdfHow to fix this error-   Exception in thread -main- q- Exit java-lang-.pdf
How to fix this error- Exception in thread -main- q- Exit java-lang-.pdf
aarokyaaqua
 
Implement the ADT stack by using an array stack to contain its entri.pdf
Implement the ADT stack by using an array stack to contain its entri.pdfImplement the ADT stack by using an array stack to contain its entri.pdf
Implement the ADT stack by using an array stack to contain its entri.pdf
SIGMATAX1
 

Similar to JavaIm not sure how to implement this code can someone help me .pdf (20)

New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxNew folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
 
StackInterface An interface for the ADT stack. Do not modif.pdf
StackInterface An interface for the ADT stack. Do not modif.pdfStackInterface An interface for the ADT stack. Do not modif.pdf
StackInterface An interface for the ADT stack. Do not modif.pdf
 
we using java code DynamicArrayjava Replace all .pdf
we using java code   DynamicArrayjava   Replace all .pdfwe using java code   DynamicArrayjava   Replace all .pdf
we using java code DynamicArrayjava Replace all .pdf
 
EmptyCollectionException-java -- - Represents the situation in which.docx
EmptyCollectionException-java --  - Represents the situation in which.docxEmptyCollectionException-java --  - Represents the situation in which.docx
EmptyCollectionException-java -- - Represents the situation in which.docx
 
using the code below write the public V add(K key, V value); that ad.pdf
using the code below write the public V add(K key, V value); that ad.pdfusing the code below write the public V add(K key, V value); that ad.pdf
using the code below write the public V add(K key, V value); that ad.pdf
 
package singlylinkedlist; public class Node { public String valu.pdf
package singlylinkedlist; public class Node { public String valu.pdfpackage singlylinkedlist; public class Node { public String valu.pdf
package singlylinkedlist; public class Node { public String valu.pdf
 
Hello need help on this lab- what you need to do is add a code to Arra.pdf
Hello need help on this lab- what you need to do is add a code to Arra.pdfHello need help on this lab- what you need to do is add a code to Arra.pdf
Hello need help on this lab- what you need to do is add a code to Arra.pdf
 
Here is what I got so far, I dont know how to write union, interse.pdf
Here is what I got so far, I dont know how to write union, interse.pdfHere is what I got so far, I dont know how to write union, interse.pdf
Here is what I got so far, I dont know how to write union, interse.pdf
 
META-INFMANIFEST.MFManifest-Version 1.0.classpath.docx
META-INFMANIFEST.MFManifest-Version 1.0.classpath.docxMETA-INFMANIFEST.MFManifest-Version 1.0.classpath.docx
META-INFMANIFEST.MFManifest-Version 1.0.classpath.docx
 
Google guava
Google guavaGoogle guava
Google guava
 
Hi, Please find my code.I have correted all of your classes.Plea.pdf
Hi, Please find my code.I have correted all of your classes.Plea.pdfHi, Please find my code.I have correted all of your classes.Plea.pdf
Hi, Please find my code.I have correted all of your classes.Plea.pdf
 
Please review my code (java)Someone helped me with it but i cannot.pdf
Please review my code (java)Someone helped me with it but i cannot.pdfPlease review my code (java)Someone helped me with it but i cannot.pdf
Please review my code (java)Someone helped me with it but i cannot.pdf
 
Confitura 2012 Bad Tests, Good Tests
Confitura 2012 Bad Tests, Good TestsConfitura 2012 Bad Tests, Good Tests
Confitura 2012 Bad Tests, Good Tests
 
java question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdfjava question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdf
 
How do I fix this error - Exception in thread -main- java-lang-NullPoi.pdf
How do I fix this error - Exception in thread -main- java-lang-NullPoi.pdfHow do I fix this error - Exception in thread -main- java-lang-NullPoi.pdf
How do I fix this error - Exception in thread -main- java-lang-NullPoi.pdf
 
mainpublic class AssignmentThree {    public static void ma.pdf
mainpublic class AssignmentThree {    public static void ma.pdfmainpublic class AssignmentThree {    public static void ma.pdf
mainpublic class AssignmentThree {    public static void ma.pdf
 
GeeCON 2012 Bad Tests, Good Tests
GeeCON 2012 Bad Tests, Good TestsGeeCON 2012 Bad Tests, Good Tests
GeeCON 2012 Bad Tests, Good Tests
 
in this assignment you are asked to write a simple driver program an.pdf
in this assignment you are asked to write a simple driver program an.pdfin this assignment you are asked to write a simple driver program an.pdf
in this assignment you are asked to write a simple driver program an.pdf
 
How to fix this error- Exception in thread -main- q- Exit java-lang-.pdf
How to fix this error-   Exception in thread -main- q- Exit java-lang-.pdfHow to fix this error-   Exception in thread -main- q- Exit java-lang-.pdf
How to fix this error- Exception in thread -main- q- Exit java-lang-.pdf
 
Implement the ADT stack by using an array stack to contain its entri.pdf
Implement the ADT stack by using an array stack to contain its entri.pdfImplement the ADT stack by using an array stack to contain its entri.pdf
Implement the ADT stack by using an array stack to contain its entri.pdf
 

More from sauravmanwanicp

Answer the following questions in reference to Drosophila melanogast.pdf
Answer the following questions in reference to Drosophila melanogast.pdfAnswer the following questions in reference to Drosophila melanogast.pdf
Answer the following questions in reference to Drosophila melanogast.pdf
sauravmanwanicp
 
The incandescent lightbulb was actually invented by Humphry Davy in 1.pdf
The incandescent lightbulb was actually invented by Humphry Davy in 1.pdfThe incandescent lightbulb was actually invented by Humphry Davy in 1.pdf
The incandescent lightbulb was actually invented by Humphry Davy in 1.pdf
sauravmanwanicp
 
Read the short article Horizontal Gene Transfer in E Coli and answer.pdf
Read the short article Horizontal Gene Transfer in E Coli and answer.pdfRead the short article Horizontal Gene Transfer in E Coli and answer.pdf
Read the short article Horizontal Gene Transfer in E Coli and answer.pdf
sauravmanwanicp
 

More from sauravmanwanicp (20)

Are hydrophobic interactions weak or strongSolutionHydrophobi.pdf
Are hydrophobic interactions weak or strongSolutionHydrophobi.pdfAre hydrophobic interactions weak or strongSolutionHydrophobi.pdf
Are hydrophobic interactions weak or strongSolutionHydrophobi.pdf
 
What is another word for account based forecast What is anothe.pdf
What is another word for account based forecast What is anothe.pdfWhat is another word for account based forecast What is anothe.pdf
What is another word for account based forecast What is anothe.pdf
 
What function can be used to return multiple numeric data such as in.pdf
What function can be used to return multiple numeric data such as in.pdfWhat function can be used to return multiple numeric data such as in.pdf
What function can be used to return multiple numeric data such as in.pdf
 
Answer the following questions in reference to Drosophila melanogast.pdf
Answer the following questions in reference to Drosophila melanogast.pdfAnswer the following questions in reference to Drosophila melanogast.pdf
Answer the following questions in reference to Drosophila melanogast.pdf
 
There are five feasible solutions to a three-objective optimization p.pdf
There are five feasible solutions to a three-objective optimization p.pdfThere are five feasible solutions to a three-objective optimization p.pdf
There are five feasible solutions to a three-objective optimization p.pdf
 
An air-filled parallel-plate capacitor has capacitance Co. If two ide.pdf
An air-filled parallel-plate capacitor has capacitance Co. If two ide.pdfAn air-filled parallel-plate capacitor has capacitance Co. If two ide.pdf
An air-filled parallel-plate capacitor has capacitance Co. If two ide.pdf
 
The incandescent lightbulb was actually invented by Humphry Davy in 1.pdf
The incandescent lightbulb was actually invented by Humphry Davy in 1.pdfThe incandescent lightbulb was actually invented by Humphry Davy in 1.pdf
The incandescent lightbulb was actually invented by Humphry Davy in 1.pdf
 
The fossil record provides little information about ancient mosses. D.pdf
The fossil record provides little information about ancient mosses. D.pdfThe fossil record provides little information about ancient mosses. D.pdf
The fossil record provides little information about ancient mosses. D.pdf
 
The DNA sequence below is a shortened version of the sequence on the .pdf
The DNA sequence below is a shortened version of the sequence on the .pdfThe DNA sequence below is a shortened version of the sequence on the .pdf
The DNA sequence below is a shortened version of the sequence on the .pdf
 
the conducting tissue found in vascular plants that functions in tra.pdf
the conducting tissue found in vascular plants that functions in tra.pdfthe conducting tissue found in vascular plants that functions in tra.pdf
the conducting tissue found in vascular plants that functions in tra.pdf
 
Show that f(x)=57^x+1 and f^-1(x)=7x-75 are inverses Choose the ap.pdf
Show that f(x)=57^x+1 and f^-1(x)=7x-75 are inverses  Choose the ap.pdfShow that f(x)=57^x+1 and f^-1(x)=7x-75 are inverses  Choose the ap.pdf
Show that f(x)=57^x+1 and f^-1(x)=7x-75 are inverses Choose the ap.pdf
 
Read the short article Horizontal Gene Transfer in E Coli and answer.pdf
Read the short article Horizontal Gene Transfer in E Coli and answer.pdfRead the short article Horizontal Gene Transfer in E Coli and answer.pdf
Read the short article Horizontal Gene Transfer in E Coli and answer.pdf
 
Please select the best answer and click submit. The owners of fou.pdf
Please select the best answer and click submit. The owners of fou.pdfPlease select the best answer and click submit. The owners of fou.pdf
Please select the best answer and click submit. The owners of fou.pdf
 
One function of the spliceosome is to (Select all that apply.)A. .pdf
One function of the spliceosome is to (Select all that apply.)A. .pdfOne function of the spliceosome is to (Select all that apply.)A. .pdf
One function of the spliceosome is to (Select all that apply.)A. .pdf
 
Match the following organelles with their key functions in the cell .pdf
Match the following organelles with their key functions in the cell  .pdfMatch the following organelles with their key functions in the cell  .pdf
Match the following organelles with their key functions in the cell .pdf
 
please choose the correct answerIn the ABO blood-type phenotype, w.pdf
please choose the correct answerIn the ABO blood-type phenotype, w.pdfplease choose the correct answerIn the ABO blood-type phenotype, w.pdf
please choose the correct answerIn the ABO blood-type phenotype, w.pdf
 
mo Press Submit until all questions are colored green and you have do.pdf
mo Press Submit until all questions are colored green and you have do.pdfmo Press Submit until all questions are colored green and you have do.pdf
mo Press Submit until all questions are colored green and you have do.pdf
 
matching chose the stage of the light reactions which the statement.pdf
matching chose the stage of the light reactions which the statement.pdfmatching chose the stage of the light reactions which the statement.pdf
matching chose the stage of the light reactions which the statement.pdf
 
Let E be the set of all even integers, and let O be the set of all o.pdf
Let E be the set of all even integers, and let O be the set of all o.pdfLet E be the set of all even integers, and let O be the set of all o.pdf
Let E be the set of all even integers, and let O be the set of all o.pdf
 
Indexes prevent the database engine from having to scan every record .pdf
Indexes prevent the database engine from having to scan every record .pdfIndexes prevent the database engine from having to scan every record .pdf
Indexes prevent the database engine from having to scan every record .pdf
 

Recently uploaded

MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MysoreMuleSoftMeetup
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
Peter Brusilovsky
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
EADTU
 

Recently uploaded (20)

VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptx
 

JavaIm not sure how to implement this code can someone help me .pdf

  • 1. Java I'm not sure how to implement this code can someone help me / guide me? thank you (Updated with PrefixMap interface included at the bottom of the code). import java.util.List; import java.util.Map; public class Storage implements PrefixMap { private Map keys; private Map> prefixes; public Storage() { // TODO Initialise your maps } /* * How many keys are stored in the map */ @Override public int size() { // TODO Implement this, then remove this comment return 0; } @Override public boolean isEmpty() { // TODO Implement this, then remove this comment return false; } /* * Get the value corresponding to the key (or null if the key is not found) * if the key contains any character other than A,C,G,T, throw MalformedKeyException * if the key is null, throw IllegalArgumentException */ @Override public String get(String key) {
  • 2. // TODO Implement this, then remove this comment return null; } /* * Insert the value into the data structure, using the given key. If the key * already existed, replace and return the old value (otherwise return null) * if the key contains any character other than A,C,G,T, throw MalformedKeyException * if the key or value is null, throw IllegalArgumentException */ @Override public String put(String key, String value) { // TODO Implement this, then remove this comment return null; } /* * Remove the value corresponding to the given key from the data structure, * if it exists. Return the old value, or null if no value was found. * if the key contains any character other than A,C,G,T, throw MalformedKeyException * if the key is null, throw IllegalArgumentException */ @Override public String remove(String key) { // TODO Implement this, then remove this comment return null; } /* * return the number of keys which start with the given prefix if the prefix * contains any character other than A,C,G,T, throw MalformedKeyException * if the prefix is null, throw IllegalArgumentException */ @Override public int countKeysMatchingPrefix(String prefix) {
  • 3. // TODO Implement this, then remove this comment return 0; } /* * return the collection of keys which start with the given prefix if the * prefix contains any character other than A,C,G,T, throw MalformedKeyException * if the prefix is null, throw IllegalArgumentException */ @Override public List getKeysMatchingPrefix(String prefix) { // TODO Implement this, then remove this comment return null; } /* * Return the number of unique prefixes * e.g. if the tree stores keys GAT, GATTC, GATTACA, this method will return 8 * because the possible prefixes are G, GA, GAT, GATT, GATTC, GATTA, GATTAC, GATTACA */ @Override public int countPrefixes() { // TODO Implement this, then remove this comment return 0; } /* * Return the sum of the lengths of all keys * e.g. if the tree stores keys GAT, GATTC, GATTACA, this method will return 15 */ @Override public int sumKeyLengths() {
  • 4. // TODO Implement this, then remove this comment return 0; } } import java.util.List; public interface PrefixMap { public boolean isEmpty(); /* * How many keys are stored in the map */ public int size(); /* * Get the value corresponding to the key (or null if the key is not found) * if the key contains any character other than A,C,G,T, throw MalformedKeyException * if the key is null, throw IllegalArgumentException */ public String get(String key); /* * Insert the value into the data structure, using the given key. If the key * already existed, replace and return the old value (otherwise return null) * if the key contains any character other than A,C,G,T, throw MalformedKeyException * if the key or value is null, throw IllegalArgumentException */ public String put(String key, String value); /* * Remove the value corresponding to the given key from the data structure, * if it exists. Return the old value, or null if no value was found. * if the key contains any character other than A,C,G,T, throw MalformedKeyException * if the key is null, throw IllegalArgumentException */ public String remove(String key); /* * return the number of keys which start with the given prefix if the prefix * contains any character other than A,C,G,T, throw MalformedKeyException
  • 5. * if the prefix is null, throw IllegalArgumentException */ public int countKeysMatchingPrefix(String prefix); /* * return the collection of keys which start with the given prefix if the * prefix contains any character other than A,C,G,T, throw MalformedKeyException * if the prefix is null, throw IllegalArgumentException */ public List getKeysMatchingPrefix(String prefix); /* * Return the number of unique prefixes * e.g. if the tree stores keys GAT, GATTC, GATTACA, this method will return 8 * because the possible prefixes are G, GA, GAT, GATT, GATTC, GATTA, GATTAC, GATTACA */ public int countPrefixes(); /* * Return the sum of the lengths of all keys * e.g. if the tree stores keys GAT, GATTC, GATTACA, this method will return 15 */ public int sumKeyLengths(); } Solution import java.util.List; import java.util.Map; public class Storage implements PrefixMap { private Map keys; private Map> prefixes; public Storage() { // TODO Initialise your maps }
  • 6. /* * How many keys are stored in the map */ @Override public int size() { // TODO Implement this, then remove this comment return 0; } @Override public boolean isEmpty() { // TODO Implement this, then remove this comment return false; } /* * Get the value corresponding to the key (or null if the key is not found) * if the key contains any character other than A,C,G,T, throw MalformedKeyException * if the key is null, throw IllegalArgumentException */ @Override public String get(String key) { // TODO Implement this, then remove this comment return null; } /* * Insert the value into the data structure, using the given key. If the key * already existed, replace and return the old value (otherwise return null) * if the key contains any character other than A,C,G,T, throw MalformedKeyException * if the key or value is null, throw IllegalArgumentException */ @Override public String put(String key, String value) { // TODO Implement this, then remove this comment
  • 7. return null; } /* * Remove the value corresponding to the given key from the data structure, * if it exists. Return the old value, or null if no value was found. * if the key contains any character other than A,C,G,T, throw MalformedKeyException * if the key is null, throw IllegalArgumentException */ @Override public String remove(String key) { // TODO Implement this, then remove this comment return null; } /* * return the number of keys which start with the given prefix if the prefix * contains any character other than A,C,G,T, throw MalformedKeyException * if the prefix is null, throw IllegalArgumentException */ @Override public int countKeysMatchingPrefix(String prefix) { // TODO Implement this, then remove this comment return 0; } /* * return the collection of keys which start with the given prefix if the * prefix contains any character other than A,C,G,T, throw MalformedKeyException * if the prefix is null, throw IllegalArgumentException */ @Override public List getKeysMatchingPrefix(String prefix) { // TODO Implement this, then remove this comment
  • 8. return null; } /* * Return the number of unique prefixes * e.g. if the tree stores keys GAT, GATTC, GATTACA, this method will return 8 * because the possible prefixes are G, GA, GAT, GATT, GATTC, GATTA, GATTAC, GATTACA */ @Override public int countPrefixes() { // TODO Implement this, then remove this comment return 0; } /* * Return the sum of the lengths of all keys * e.g. if the tree stores keys GAT, GATTC, GATTACA, this method will return 15 */ @Override public int sumKeyLengths() { // TODO Implement this, then remove this comment return 0; } } import java.util.List; public interface PrefixMap { public boolean isEmpty(); /* * How many keys are stored in the map */ public int size();
  • 9. /* * Get the value corresponding to the key (or null if the key is not found) * if the key contains any character other than A,C,G,T, throw MalformedKeyException * if the key is null, throw IllegalArgumentException */ public String get(String key); /* * Insert the value into the data structure, using the given key. If the key * already existed, replace and return the old value (otherwise return null) * if the key contains any character other than A,C,G,T, throw MalformedKeyException * if the key or value is null, throw IllegalArgumentException */ public String put(String key, String value); /* * Remove the value corresponding to the given key from the data structure, * if it exists. Return the old value, or null if no value was found. * if the key contains any character other than A,C,G,T, throw MalformedKeyException * if the key is null, throw IllegalArgumentException */ public String remove(String key); /* * return the number of keys which start with the given prefix if the prefix * contains any character other than A,C,G,T, throw MalformedKeyException * if the prefix is null, throw IllegalArgumentException */ public int countKeysMatchingPrefix(String prefix); /* * return the collection of keys which start with the given prefix if the * prefix contains any character other than A,C,G,T, throw MalformedKeyException * if the prefix is null, throw IllegalArgumentException */ public List getKeysMatchingPrefix(String prefix); /* * Return the number of unique prefixes * e.g. if the tree stores keys GAT, GATTC, GATTACA, this method will return 8
  • 10. * because the possible prefixes are G, GA, GAT, GATT, GATTC, GATTA, GATTAC, GATTACA */ public int countPrefixes(); /* * Return the sum of the lengths of all keys * e.g. if the tree stores keys GAT, GATTC, GATTACA, this method will return 15 */ public int sumKeyLengths(); }