static List<Object> getList(ThreadContext context, IRubyObject value) {
RubyArray ruby_array = (RubyArray)RuntimeHelpers.invoke(context, value, "to_a");
List<Object> list = new ArrayList<Object>();
while (true) {
IRubyObject element = ruby_array.shift(context);
if (element.isNil()) break;
list.add(DiametricUtils.convertRubyToJava(context, element));
}
return Collections.unmodifiableList(list);
}