late-daybreak-68928
04/02/2026, 1:47 AMUserContext user1Context = UserContext.builder()
.attributesJson("{\"id\":\"user_123\",\"country\":\"US\",\"premium\":true}")
.build();
_boolean_ showNewFeature = gb.isOn("new-homepage", user1Context);
String buttonColor = gb.getFeatureValue("button-color", "blue", user1Context);powerful-spoon-16837
04/02/2026, 10:27 AM["blue", "green"]. The true/false combos are only for boolean feature flags, not really useful for A/B.
2) You're right, that's just a misleading example in the docs. showNewFeature is declared but never used, which is confusing. The pattern is correct though: build UserContext first, then call getFeatureValue to get the actual variation value for that user. The "blue" is just the default fallback if the user isn't in the experiment.
FYI:
_boolean_ showNewFeature = gb.isOn("new-homepage", user1Context); - Returns true if the value is a truthy value;
String buttonColor = gb.getFeatureValue("button-color", "blue", user1Context); - Returns the value cast to the generic type. Type is inferred based on the defaultValue argument provided.
Docslate-daybreak-68928
04/03/2026, 2:26 PMtrue/false
2. for the gb.isOn will determine if it's a truthy value.. then, if use the same id value for example "test" will it always return the same true/false or can be on first second attempt true, and third attempt false?powerful-spoon-16837
04/03/2026, 2:50 PMlate-daybreak-68928
04/05/2026, 7:33 AM