java - How to make my HashTable work on for a specific type -


i need create hashtable project.

here how define hashtable is:

public class studenthashtable<name, dateofbirth> {  } 

the way create hashtable following:

studenthashtable<string,integer> hashmap = new studenthashtable<string,integer>(); 

as stands now, work object has key of string type , value of integer type. need think can force hashtable accept objects of type student has key of string type , value of integer type?

if want customized hashmap only accept class student, odd request collections should generic usually, following. make setters work class student. way guaranteed not able accept except want.

example:

public void put(student student){...}  public void putall(student... students){...} 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -