Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Object[] array = { ... };
- System.out.println(array.length);
- Object[][] array = { ... };
- int count = Stream.of(array).mapToInt(m -> m.length).sum();
- System.out.println(count);
- public static int count(Object[][] array) {
- int result = 0;
- for (Object[] m : array) {
- result += m.length;
- }
- return result;
- }
- String s = "...";
- System.out.println(s.length());
- Set<Integer> s = new TreeSet<Integer>();
- s.add(...);
- System.out.println(s.size());
- public class ExampleArrayLenght {
- public static void main(String[] args) {
- String[] arrays = {"one", "two", "three"};
- int arrayLength = arrays.length;
- System.out.println("Длинна массива = " + arrayLength + " элемента.");
- }
- }
- int[] array = {1, -4, 3, 5};
- int length = array.length;
- public int countArr(List<Integer> arr){
- return (int) arr.stream().count();
- }
Add Comment
Please, Sign In to add comment