diff --git a/GameArena.java b/GameArena.java index e31ecbd..e1d4f5b 100644 --- a/GameArena.java +++ b/GameArena.java @@ -359,5 +359,18 @@ public boolean spacePressed() return space; } + //NB use lazy instantiation + private String[] names=null; + /** + * Gets the known colour names. + * @return an array of the names of pre-defined colours known by the GameArena + */ + public String[] getDefaultColourNames(){ + if (names==null){ + names = colours.keySet().stream().toArray(String[]::new); + } + return names; + } + }