HashMap
public Map<String, BarrackData> barrack = new HashMap<String, BarrackData>();
BarrackData.java
public class BarrackData {
int A;
int B;
int C;
int D;
int E;
String Title;
public BarrackData(int a, int b, int c, int d, int e, String title) {
A = a;
B = b;
C = c;
D = d;
P = p;
Title = title;
}
How can I save this HashMap?
And load it?
I tried different methodes with Objectin/outputstream,
it ended up with NotSerializable, ObjectSteam and IO exception,
Where i have no clue how to deal with them.
Only
Serializableclasses may be serialized: Just addimplements Serializableto your class:Note that to actually be serialized, all fields within the class must be
Serializable, however java primitives, arrays (if the element type isSerializable),java.langclasses (likeString) andCollections(if the element type isSerializable) areSerializable, so you’re OK.