APISonar


java.util.ArrayList.stream

> java > util > ArrayList > stream
java APIs util APIs ArrayList APIs stream APIs

Example 1
private static Line parseLine(StreamTokenizer stream) throws IOException, ParseException {
    String token = nextEmptyOrOpen(stream);
    if (token.equals(EMPTY)) {
      return null;
    }
    ArrayList<Double> lats = new ArrayList();
    ArrayList<Double> lons = new ArrayList();
    parseCoordinates(stream, lats, lons);
    return new Line(lats.stream().mapToDouble(i->i).toArray(), lons.stream().mapToDouble(i->i).toArray());
  }
Example 2
private ArrayList<String> _params;

  public String genCode()
  {
    return _params.stream().collect( Collectors.joining( "," ) );
  }
Example 3
private final ArrayList<AcceptingSelector> acceptors;

    public void close() throws IOException {
        if (isOpen.compareAndSet(true, false)) {
            IOUtils.close(Stream.concat(acceptors.stream(), socketSelectors.stream()).collect(Collectors.toList()));
        }
    }
Example 4
private Iterable<Document> reifyDocuments( ArrayList<Supplier<Document>> documents )
    {
        return () -> documents.stream().map( Supplier::get ).iterator();
    }
Example 5
private List<Long> getSegmentsToSeal(ArrayList<Segment> sorted) {
        return sorted.stream()
                     .map(Segment::getSegmentId).collect(Collectors.toList());
    }
Example 6
public void givenEmptyStream_whenWindowed_shouldReturnIterableWithSizeZero() {
        ArrayList<Integer> ints = new ArrayList<>();

        ints.stream().collect(maxBy((a, b) -> a.toString().compareTo(b.toString())));

        List<List<Integer>> windows = StreamUtils.windowed(ints.stream(), 2).collect(toList());

        assertThat(windows, iterableWithSize(0));
    }
Example 7
private void accumulateExperience(ArrayList<String> exp) {
        if (exp != null && !exp.isEmpty()) {
            exp.stream().forEach(e -> experience.compute(e.toLowerCase(), (vKey, oldValue) -> oldValue == null ? 1 : oldValue + 1));
        } else {
            experience.put("keine", experience.get("keine") + 1);
        }
    }
Example 8
private static int[] computeIndexesToMap( List<FieldSignature> inputSignature )
    {
        ArrayList<Integer> integers = new ArrayList<>();
        for ( int i = 0; i < inputSignature.size(); i++ )
        {
            if ( inputSignature.get( i ).needsMapping() )
            {
                integers.add( i );
            }
        }
        return integers.stream().mapToInt( i -> i ).toArray();
    }
Example 9
protected ArrayList<DataIdentifier> _inputParams;

	public DataIdentifier getInputParam(String name) {
		return _inputParams.stream()
			.filter(d -> d.getName().equals(name))
			.findFirst().orElse(null);
	}
Example 10
public synchronized List<String> getLocations() {
    ArrayList<String> locations = new ArrayList<>();

    for (Backend backend : backends) {
      locations.addAll(backend.getTargets());
    }
    return locations.stream().distinct().collect(Collectors.toList());
  }
Example 11
private String asUnorderedList(ArrayList<String> items) {
        StringBuilder ul = new StringBuilder();
        if (items != null && !items.isEmpty()) {
            ul.append("<ul>");
            items.stream().forEach(i -> ul.append("<li>").append(i).append("</li>"));
            ul.append("</ul>");
        }
        return ul.toString();
    }
Example 12
private ArrayList<Integer> mChannelMask = null;

    private Map<String, Object> createScanOptionMap() {
        Map<String, Object> map = new HashMap();

        if (mChannelMask != null) {
            LowpanProperties.KEY_CHANNEL_MASK.putInMap(
                    map, mChannelMask.stream().mapToInt(i -> i).toArray());
        }

        if (mTxPower != Integer.MAX_VALUE) {
            LowpanProperties.KEY_MAX_TX_POWER.putInMap(map, Integer.valueOf(mTxPower));
        }

        return map;
    }
Example 13
private ArrayList<T> completeList;

    private void reactToQueryChanges() {
        getEditor().addEventHandler(KeyEvent.KEY_RELEASED, (KeyEvent event) -> {
            UserThread.execute(() -> {
                String query = getEditor().getText();
                var exactMatch = completeList.stream().anyMatch(item -> asString(item).equalsIgnoreCase(query));
                if (!exactMatch) {
                    if (query.isEmpty())
                        removeFilter();
                    else
                        filterBy(query);
                    forceRedraw();
                }
            });
        });
    }
Example 14
private final ArrayList<FreezePeriod> mFreezePeriods;

    public String toString() {
        return String.format("SystemUpdatePolicy (type: %d, windowStart: %d, windowEnd: %d, "
                + "freezes: [%s])",
                mPolicyType, mMaintenanceWindowStart, mMaintenanceWindowEnd,
                mFreezePeriods.stream().map(n -> n.toString()).collect(Collectors.joining(",")));
    }
Example 15
private final ArrayList<Data> listValues;

	public boolean hasReferences( Data d ) {
		if(nonListValues.contains(d)) {
			return true;
		}
		else if(listValues.size() > 0) {
			return listValues.stream().anyMatch(e -> (e instanceof ListObject) ?
					((ListObject)e).getData().contains(d) : e == d);
		}
		else {
			return false;
		}
	}
Example 16
@Override public BigDecimal magnitude(Object value) {
        ArrayList<?> narrowed = narrow(value);

        if (narrowed.isEmpty())
            return ZERO;

        BigDecimal elementsMagnitude =
            narrowed.stream()
                .map(e -> componentGenerators().get(0).magnitude(e))
                .reduce(ZERO, BigDecimal::add);
        return BigDecimal.valueOf(narrowed.size()).multiply(elementsMagnitude);
    }
Example 17
final ArrayList<ByteBuffer> buffers = new ArrayList<>();

  public InputStream asInputStream() throws IOException
  {
    checkOpen();
    Function<ByteBuffer, ByteSource> byteBufferToByteSource = buf -> new ByteSource()
    {
      @Override
      public InputStream openStream()
      {
        ByteBuffer inputBuf = buf.duplicate();
        inputBuf.flip();
        return new ByteBufferInputStream(inputBuf);
      }
    };
    return ByteSource.concat(buffers.stream().map(byteBufferToByteSource).collect(Collectors.toList())).openStream();
  }
Example 18
private ArrayList<ReportLine> report = new ArrayList<>();

    public String toString(String indent) {
        return report.stream()
                .map(line -> line.toString(indent, componentName + "."))
                .collect(joining("\n"));
    }
Example 19
private String getBuildFlags() {
    ArrayList<String> flags = new ArrayList<>(buildWithBuckFlags);
    if (!flags.contains(REPORT_ABSOLUTE_PATHS)) {
      flags.add(0, REPORT_ABSOLUTE_PATHS);
    }
    if (!flags.contains(SHOW_OUTPUT)) {
      flags.add(0, SHOW_OUTPUT);
    }
    return flags.stream()
        .map(Escaper.BASH_ESCAPER::apply)
        .collect(Collectors.joining(" "));
  }
Example 20
private ArrayList<Approval> store = new ArrayList<Approval>();

    public List<Approval> getApprovalsForUser(String userId, final String zoneId) {
        return store.stream()
            .filter(approval -> userId.equals(approval.getUserId()))
            .collect(Collectors.toList());
    }
Example 21
private static HashMap<String, String> createLookupMap(ResourceBundle baseBundle) {
        final ArrayList<String> baseKeys = Collections.list(baseBundle.getKeys());
        return new HashMap<>(baseKeys.stream().collect(
                Collectors.toMap(
                        key -> new LocalizationKey(key).getTranslationValue(),
                        key -> new LocalizationKey(baseBundle.getString(key)).getTranslationValue())
        ));
    }
Example 22
public static Stream<Arguments> staticFiles()
    {
        ArrayList<Arguments> ret = new ArrayList<>();

        ret.add(Arguments.of("test-1g.dat", 1 * GB));
        ret.add(Arguments.of("test-4g.dat", 4 * GB));
        ret.add(Arguments.of("test-10g.dat", 10 * GB));

        return ret.stream();
    }
Example 23
public List<String> getJobGroupNames() throws JobPersistenceException {
    return execute(db -> {
      ArrayList<String> result = new ArrayList<>();
      for (JobDetailEntity entity : jobDetailEntityAdapter.browse(db)) {
        result.add(entity.getGroup());
      }
      return result.stream().distinct().collect(Collectors.toList());
    });
  }
Example 24
public static boolean requiresRecompilation( ArrayList<Hop> hops ) {
		if( hops == null )
			return false;
		synchronized( hops ) {
			Hop.resetVisitStatus(hops);
			return hops.stream()
				.anyMatch(h -> rRequiresRecompile(h));
		}
	}
Example 25
private final ArrayList<ByteBuffer> memoryMappedRegions;

	public BoundedData.Reader createReader(ResultSubpartitionView ignored) {
		checkState(!fileChannel.isOpen());

		final List<ByteBuffer> buffers = memoryMappedRegions.stream()
				.map((bb) -> bb.duplicate().order(ByteOrder.nativeOrder()))
				.collect(Collectors.toList());

		return new MemoryMappedBoundedData.BufferSlicer(buffers);
	}