Traffic light structure array

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shainarushton6
    New Member
    • Oct 2016
    • 2

    Traffic light structure array

    Does anybody know the structure of an array that could be used to handle a traffic light sequence?
  • Oralloy
    Recognized Expert Contributor
    • Jun 2010
    • 988

    #2
    shainarushton6,

    What sort of information do you want in the sequence? Strings? Objects?

    Unless you can give more information about what you want to accomplish, I don't think that we can help you beyond suggesting an array of objects, or a "Map", depending on what the index is.

    Code:
    String Colours[] = {"Red", Yellow", "Grun"};
    
    Map<String, Object> Lampz = new Map<String, Object>();
    Lampz.put("Red", "<object for Red here>");
    Lampz.put("Yellow", "<object for Yellow here>");
    Lampz.put("Grun", "<object for Grun here>");
    Cheers!
    Oralloy

    Comment

    Working...