StructKeySet
Build a Set containing the keys of a Struct.
Key names are extracted as plain Strings via Key.getName(), so the resulting Set always holds String values. The backing variant can be configured; use "linked" to preserve the Struct's iteration order.
Method Signature
StructKeySet(struct=[struct], type=[string])Arguments
Argument
Type
Required
Description
Default
struct
struct
true
The struct whose keys should populate the set.
type
string
false
The backing variant: "default" / "hash" (HashSet), "linked" / "ordered" (LinkedHashSet, preserves Struct iteration order), or "sorted" / "tree" (TreeSet, alphabetical order).
default
Examples
Get the keys of a struct as a Set
Returns a BoxSet containing all keys of the struct.
s = { name: "Luis", age: 42, email: "x@y.z" }.keySet();
writeOutput( s.size() );
Result: 3
Using the standalone function form
Result: 3
Case sensitivity mirrors the source struct
A case-sensitive struct produces a case-sensitive key Set.
Result: true,2
Related
Last updated
Was this helpful?
