Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


rahul tiwari
hash map
1 Answer(s)      3 years and 2 months ago
Posted in : Java Beginners


how to add object of test class in a hashmap test class is as follows class test{ String str1; String str2; String str3; int i1; int i2; }

values of instance variable is coming from different database tables;


Advertisement
View Answers

September 29, 2011 at 12:56 PM


import java.util.*;

class Test{
String str1; 
String str2;
String str3; 
int i1;
int i2;
Test(String str1,String str2,String str3,int i1,int i2){
this.str1=str1;
this.str2=str2;
this.str3=str3;
this.i1=i1;
this.i2=i2;
}
public String getStr1(){
    return str1;
}
public String getStr2(){
    return str2;
}
public String getStr3(){
    return str3;
}
public int getI1(){
    return i1;
}
public int getI2(){
    return i2;
}
}
class Example{
    public static void main(String[] args) 
    {
        String str1="A",str2="B",str3="C";
        int i1=1,i2=2;
        HashMap<Integer,Test> map=new HashMap<Integer,Test>();
        map.put(new Integer(1),new Test(str1,str2,str3,i1,i2));
    }
}


Related Tutorials/Questions & Answers:
Hash Map
Hash Map  how to add the hash map objects in the list and iterate the objects
hash map
hash map  write a program in hash map , that shows the value in asending order. but not key value. ex: key value ==== ===== k5 ashutosh k1 babita k7 debasis k2 vikas plz help me
Advertisements
hash map
hash map  how to add object of test class in a hashmap test class is as follows class test{ String str1; String str2; String str3; int i1; int i2...=2; HashMap<Integer,Test> map=new HashMap<Integer,Test>
java code to compare two hash map objects
java code to compare two hash map objects  java code to compare two hash map objects
Using Arraylist or Hash Map - Java Interview Questions
Using Arraylist or Hash Map  what could b the pros and cons changing between Hash Map to Array List
read from file and store using hash map
read from file and store using hash map  I was stuck with a java project where I have to read a file with two different concepts and store them differently in hashmap. My data file would be something like Adults: Name, xyz
map
map  using map, i want display message based on id selected [both are strings]   i do no   Hi Friend, Try the following code...) { Map map=new HashMap(); map.put("Message1","Hello
Map
Map  If I have an object implementing the Map interface in Java and I wish to iterate over every pair contained within it, what is the most efficient way of going through the map either iterator or for each loop or for loop
hash value
hash value   what is the meaning of this line private int hashValue = 0
Hash table
Hash table  Hi guys.. I have question about hash table How to implement a hash table of English words? with these methods ï??· A method put(s...() which returns the number of strings in the table. ï??· A hash method
hash function for java strings
hash function for java strings  hash function for java strings   int hash=7; for (int i=0; i < strlen; i++) { hash = hash*31+charAt(i
Creating a Hash Table
Creating a Hash Table : Java Util       This section explains the implementation of the hash table. What is the hash table and how to create that? Hash Table holds
Java Hash table
Java Hash table   Hi I have to create code to allow the insertion of a sequence of numbers into a hash table,using a fixed size hash table. Then i... of numbers; insert these into the hash table. Can anyone give me any help
Store ResultSt Data in a Map
Store ResultSt Data in a Map  i want to store data in a hash Map .Please solve my problem as soon as possible
Example to show Hash map exception in java
Example to show Hash map exception in java  ... on Hash table. Interface in Mapping -  1)The Hash Map implements map. 2...-value pairs Understand with Example Hash map in java is same as the Hash table
Map interface
Map interface  What is the Map interface
Hash value is not same - Java Beginners
Hash value is not same  Hi, I've two Excel files with same data.... I've generated one way hash using SHA-1 algorithm. But the hash value of Excel 2003 files is not same as the hash value of Excel 2007 file. What might
Interactive map
Interactive map  hi........ i require map to be zoom in and enlarge the area and show its detail. Can anyone tel me how can this be done using java swings .... plz help
Map code
Map code  hi................ I have map of navi mumbai, where i want to see the location vashi, nerul, turbhe.... means want to zoom into this area and then again zoom in and see nerul location more properly or other location
Map
parse map in java
parse map in java  What is a Parser? Can you give the source code to parse map in Java
solution of k map in c
solution of k map in c  write a program in c to solve k-map with digital circuit
Map java Object to database.
Map java Object to database.  How do you map Java Objects with Database tables
Iterate Tag used with a Map.
Iterate Tag used with a Map.  How Iterate Tag used with a Map
java program(Hash Table) - Java Beginners
java program(Hash Table)  Store the names of 10 major cities and the names of corresponding countries in a hash table. Accept the name of a city... argument or specifies a city that is not in the hash table.  Hi friend
Usage of Hash Code - Java Interview Questions
Usage of Hash Code  Dear sir, What is Hashcode in Java and What is its usage? Thanks and Regards M.KehtraBalan  Hi Friend, A hashCode is a way of computing a small (32-bit) numeric key from a long
about google map
about google map  how to add google map in website
about google map
about google map  how to add google map in website
One way hash in Java - Java Beginners
One way hash in Java  Hi, What is one way hashing. How... their hash value in Java. Please give some examples. Thank You,  Hi Friend, A one-way hash function is used to create digital signatures, which in turn
add google map javascript
add google map javascript  How can i add google map using javascript in my web page?   Search for the " Google Maps Javascript API" it will allow you to embed the Google Map into your web Page
map on web page
map on web page   i want to insert an area map in my web page how can i do it ? please answer me soon. Its urgent
Advertisements
 

 

 

DMCA.com