If you're only ever going to have 2 sentences you could create a class to store the info e.g
public class WordObj {
private String word;
private String sentence1, sentence2;
public WordObj(String word, String definition1, String definition2) {
this.word = word;
this.sentence1 = definition1;
this.sentence2 = definition2;
}
public String getWord() {
return word;
}
public String getSentence1() {
return sentence1;
}
public String getSentence2() {
return sentence2;
}
}
Then use it like:
ArrayList<WordObj> words = new ArrayList<>();
words.add(new WordObj("Apple", "I like eating the apple", "An apple is red"));
EDIT:
For a variable amount of sentences:
public class WordObj {
private String word;
private ArrayList<String> sentences;
public WordObj(String word, ArrayList<String> sentences) {
this.word = word;
this.sentences = sentences;
}
public String getWord() {
return word;
}
public ArrayList<String> getSentences() {
return sentences;
}
public String getSentence(int position) {
return sentences.get(position);
}
}
Usage:
ArrayList<WordObj> words = new ArrayList<>();
ArrayList<String> appleSentences = new ArrayList<>();
appleSentences.add("I like eating the apple");
appleSentences.add("An apple is red");
words.add(new WordObj("Apple", appleSentences));
Map<String, List<String>>).