我有一些类似的东西:
import java.util.HashMap;
import java.util.List;
public class A {
HashMap<Long, List<B>> hashMap = new HashMap<Long, List<B>>();
}
class B{
int a;
int b;
int c;
}
我想把这个存储在数据库中,因为它将是非常巨大的。
我将在HashMap中有250000000多个键,每个键代表巨大的数据列表(比如列表大小可能在1000左右)。
如何才
假设我有一个person类,并且等式基于id属性。下面是Person类的实现-
class Person {
private int id;
private String firstName;
public Person(int id, String firstName) {
super();
this.id = id;
this.firstName = firstName;
}
public int getId() {
return id;
}
public void
我不明白这个。它只在linux中发生(在我的机器上运行得很好)。只有当我正在读取的文件中有特殊字符时,才会发生这种情况。这会是linux和Character.equals()的问题吗?
调用HashMap.get()的另一个函数中的代码。这将使用一个特殊的字符为每个Hashmap.get()打印"null“。
fis = new FileInputStream(fromFile);
int fromCharInt;
//read a byte at a time from the file
while ((fromCharInt = fis.read()) != -1) {
假设我想要一个分数的HashMap。
Map<String,Integer> grades = new HashMap<String,Integer>();
grades.put("John", 87); // this work due to auto-boxing right?
grades.put("Luke", Integer(85)); // non-autoboxed, is this redundant?
为什么地图在左边,HashMap<K, V>( );在右边?当您创建对象时,需要类型一致性,这难道