The size of a lazy List

@param list A LazyList returned from LazyList.add(Object) or null
@return the size of the list.
335474
public static int size(Object list) {
        if (list == null)
            return 0;
        if (list instanceof List)
            return ((List<?>) list).size();
        return 1;
    }
1214956
public <T> List<T> subList(List<T> list) {
        if (!list.isEmpty()) {
            int from = offset != null ? toInt(offset) : 0;
            int to = limit != null ? (from + toInt(limit)) : list.size();
            return list.subList(from, Math.min(to,list.size()));
        } else {
            return list;
        }
    }
73614
public static int getListYScroll(@NonNull final ListView list) {
        View child = list.getChildAt(0);
        return child == null ? -1
            : list.getFirstVisiblePosition() * child.getHeight() - child.getTop() + list.getPaddingTop();
    }
704760
public static <T> List<T> toImmutableList(final List<? extends T> list) {
    switch (list.size()) {
      case 0:
        return Collections.emptyList();
      case 1:
        return Collections.singletonList(list.get(0));
      default:
        return Collections.unmodifiableList(list);
    }
  }
1024843
public static int[] listToMap(int[] list) {
        list = pad(list);
        int[] bitMap = new int[(int)(list.length / WORD_LENGTH)];
        Arrays.fill(bitMap, 0);
        int j = -1;
        for (int i = 0; i < list.length; i++) {
            if (i % WORD_LENGTH == 0) {
                j++;
            }
            bitMap[j] |= (list[i] << ((WORD_LENGTH - 1) - (i % WORD_LENGTH)));
        }
        return bitMap;
    }
922988
public static int computeListSize(int order, List list, FieldType type, boolean debug, File path, boolean packed,
            boolean sizeOnly) {
        int size = 0;
        if (list == null || list.isEmpty()) {
            return size;
        }

        int dataSize = 0;
        for (Object object : list) {
            dataSize += computeSize(order, object, type, debug, path);
        }
        size += dataSize;
        if (type != FieldType.OBJECT) {
            if (packed) {
                if (!sizeOnly) {
                    size += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(dataSize);
                    int tag = CodedConstant.makeTag(order,
                            WireFormat.WIRETYPE_LENGTH_DELIMITED);
                    size += com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(tag);
                }
            } else {
                size += list.size() * CodedOutputStream.computeTagSize(order);
            }
        }
        return size;
    }
459839
public static <T> T randomElementOf(final List<T> list) {
        if (list.isEmpty()) {
            return null;
        }
        return list.get(nextInt(0, list.size()));
    }
441790
public static <E> List<E> compact(final List<E> list) {
        return filter(list, new Predicate<E>() {
            @Override
            public boolean test(E arg) {
                return !String.valueOf(arg).equals("null") && !String.valueOf(arg).equals("0")
                    && !String.valueOf(arg).equals("false") && !String.valueOf(arg).equals("");
            }
        });
    }
885691
public int size() {
        int count=0;
        for(Value val: map.values())
            count+=val.count();

        return count;
    }
285008
public static <E> E firstInList(List<E> list){
    	if (list == null || list.size() == 0){
    		return null;
    	}else{
    		return list.get(0);
    	}
    }
1112053
public static <T> List<T> emptyToNull(final List<T> list) {
        if (isEmpty(list)) {
            return null;
        } else {
            return list;
        }
    }
411529
public static int[] unbox (Collection<Integer> list)
    {
        if (list == null) {
            return null;
        }
        int[] unboxed = new int[list.size()];
        int ii = 0;
        for (Integer value : list) {
            unboxed[ii++] = value;
        }
        return unboxed;
    }
489788
public void setList(List<?> list) {
		this.checkNull(list);
		this.list.add(list);
		this.type.add(List.class);
	}
571883
@Override
    public int size() {
        Node h = putStack.get();
        int putStackSize = h == null ? 0 : h.size;
        return putStackSize + takeStackSize.get();
    }
808649
@SuppressWarnings("unchecked")
    public static <E> E[] toArray(final List<E> list) {
        E[] array = null;
        if (list != null && list.size() > 0) {
            array = (E[]) Array.newInstance(list.get(0).getClass(), list.size());
            for (int i = 0; i < list.size(); i++) {
                if (list.get(i) != null) {
                    array[i] = list.get(i);
                } else {
                    array[i] = null;
                }
            }
        }
        return array;
    }
209536
@Nonnull
  public List<E> toList() {
    return new AbstractList<E>() {
      @Override
      public E get(final int index) {
        return Seq.this.get(index);
      }

      @Override
      public int size() {
        return length();
      }
    };
  }
479232
public static int indexOfNull (Object[] list)
    {
        if (list != null) {
            for (int ii=0, nn = list.length; ii < nn; ii++) {
                if (list[ii] == null) {
                    return ii;
                }
            }
        }
        return -1;
    }