I am trying to create a simple regex kind of thing for my own use where a character in a string can either be an exact match or one in among a set of characters belonging to a group (e.g., Group CAPS will have all uppercase characters - 'A', 'B', etc.). Therefore a regex such as - CAPS p p l e
- should match 'Apple' or a regex such as - DIGIT DIGIT . DIGIT
- should match 76.3.
I am trying to store this regex pattern in an array {CAPS, 'p', 'p', 'l', 'e'}
.
Now, Java will allow me to declare an array of type char[]/Character[]
or Group[]
, where Group is a class I have constructed that represents such groups of characters. If I need to have a hybrid array to be able to store above mentioned patterns, what other options do I have other than declaring an array of type Object[]
?
I really don't want to be dealing with an array of type Object[]
.