Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

Editing Snippet ID: #1008537
Snippet name:
Category, Type:
Content:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// currently collection and map only
svoid pnlStruct(O o) {
  if (o cast Collection) pnlStruct(o);
  else if (o cast Map) pnlStruct(o);
  else if (o != null) pnlStruct(ll(o));
}
static <A, B extends Collection<A>> B pnlStruct(B l) {
  pnlStruct((Iterable<A>) l);
  ret l;
}
static <A> Iterable<A> pnlStruct(Iterable<A> l) {
  ret pnlStruct("", l);
}
static <A> Iterable<A> pnlStruct(S prefix, Iterable<A> l) {
  int i = 0;
  if (l != null) for (A a : l) print(prefix + (++i) + ". " + 
struct_noStringSharing(a));
  ret l;
}
static <A> A[] pnlStruct(A[] l) {
  pnlStruct(asList(l));
  ret l;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Comment:
Public (visible to everyone):
Created: 2017-05-22 11:36:57

This page without fancy editor.