MCPcopy Create free account
hub / github.com/bazelbuild/bazel / keys

Method keys

src/main/java/net/starlark/java/eval/Dict.java:418–432  ·  view source on GitHub ↗
(StarlarkThread thread)

Source from the content-addressed store, hash-verified

416 }
417
418 @StarlarkMethod(
419 name = "keys",
420 doc =
421 "Returns the list of keys:"
422 + "<pre class=\"language-python\">{2: \"a\", 4: \"b\", 1: \"c\"}.keys() == [2, 4, 1]"
423 + "</pre>\n",
424 useStarlarkThread = true)
425 public StarlarkList<?> keys(StarlarkThread thread) throws EvalException {
426 Object[] array = new Object[size()];
427 int i = 0;
428 for (K e : contents.keySet()) {
429 array[i++] = e;
430 }
431 return StarlarkList.wrap(thread.mutability(), array);
432 }
433
434 private static final Dict<?, ?> EMPTY = new Dict<>(ImmutableMap.of());
435

Calls 4

sizeMethod · 0.95
wrapMethod · 0.95
mutabilityMethod · 0.65
keySetMethod · 0.45