groovysh

How do you declare and use a Set data structure in groovysh?

一曲冷凌霜 提交于 2019-12-01 00:00:03
问题 I've tried: groovy:000> Set<String> s = ["a", "b", "c", "c"] ===> [a, b, c] groovy:000> s Unknown property: s I want to be able to use this as a set, but even if I pass it explicitly, it turns it into an ArrayList: groovy:000> joinList(["a", "b", "c", "c"]) ERROR groovy.lang.MissingMethodException: No signature of method: groovysh_evaluate.joinList() is applicable for argument types: (java.util.ArrayList) values: [[a, b, c, c]] Possible solutions: joinList(java.util.Set) 回答1: This problem