Interesting approach, why not just hide it in a method? Now you have a variable that doesn't make sense outside of a very specific constant thats public. E.g.
getHomeAddress(final String[] splitString) and getEmail(final String[] splitString), these should probably be private too as splitString would be specific.
Or just naming the variable? e.g. final var homeAddress = splitString[7], actually that would probably make more sense as the reusability is likely limited. Then the code to me is self documenting, e.g. 7 = home address as the var is named.
@kfwerf Yea these also seem like great ideas! My post was one possible example but as you've shown, there are many other ways to do this. Thanks for brainstorming other ideas!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Interesting approach, why not just hide it in a method? Now you have a variable that doesn't make sense outside of a very specific constant thats public. E.g.
getHomeAddress(final String[] splitString)
andgetEmail(final String[] splitString)
, these should probably be private too as splitString would be specific.Or just naming the variable? e.g.
final var homeAddress = splitString[7]
, actually that would probably make more sense as the reusability is likely limited. Then the code to me is self documenting, e.g. 7 = home address as the var is named.@kfwerf Yea these also seem like great ideas! My post was one possible example but as you've shown, there are many other ways to do this. Thanks for brainstorming other ideas!