import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Collectors;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelTidAspect;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace;
import org.eclipse.tracecompass.analysis.timing.core.segmentstore.AbstractSegmentStoreAnalysisModule;
-import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.tracecompass.segmentstore.core.ISegment;
import org.eclipse.tracecompass.segmentstore.core.ISegmentStore;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.segment.ISegmentAspect;
-import com.google.common.base.Function;
-import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
/**
// String syscallName = fLayout.getSyscallNameFromEvent(event);
long startTime = event.getTimestamp().getValue();
String syscallName = eventName.substring(layout.eventSyscallEntryPrefix().length());
- FluentIterable<String> argNames = FluentIterable.from(event.getContent().getFieldNames());
- Map<String, String> args = argNames.toMap(new Function<String, String>() {
- @Override
- public String apply(@Nullable String input) {
- return checkNotNull(event.getContent().getField(input).getValue().toString());
- }
- });
- SystemCall.InitialInfo newSysCall = new SystemCall.InitialInfo(startTime, NonNullUtils.checkNotNull(syscallName), NonNullUtils.checkNotNull(args));
+
+ Map<String, String> args = event.getContent().getFieldNames().stream()
+ .collect(Collectors.toMap(Function.identity(),
+ input -> checkNotNull(event.getContent().getField(input).getValue().toString())));
+
+ SystemCall.InitialInfo newSysCall = new SystemCall.InitialInfo(startTime, checkNotNull(syscallName), checkNotNull(args));
fOngoingSystemCalls.put(tid, newSysCall);
} else if (eventName.startsWith(layout.eventSyscallExitPrefix())) {
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.junit.rules.TestRule;
import org.junit.rules.Timeout;
-import com.google.common.base.Functions;
-import com.google.common.collect.FluentIterable;
import com.google.common.collect.HashMultiset;
import com.google.common.collect.Iterables;
import com.google.common.collect.Iterators;
/*
* Convert the test's testBuffer into an array of String, one for each
- * character. There are probably simpler ways of doing this, but it
- * would not look as impressive.
+ * character.
*/
- FluentIterable<Character> fi = FluentIterable.from(Chars.asList(testString.toCharArray()));
- List<String> strings = fi.transform(Functions.toStringFunction()).toList();
+ List<String> strings = Chars.asList(testString.toCharArray()).stream()
+ .map(Object::toString)
+ .collect(Collectors.toList());
Iterable<Iterable<String>> results =
runConcurrencyTest(queue, strings, poisonPill, 1, 1, 1);
import java.util.Collections;
import java.util.List;
import java.util.NavigableSet;
+import java.util.Optional;
import java.util.Set;
import java.util.TreeSet;
+import java.util.stream.Collectors;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.internal.lttng2.ust.core.analysis.debuginfo.UstDebugInfoBinaryFile;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfUtils;
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Ordering;
/**
* Analysis to provide TMF Callsite information by mapping IP (instruction
List<Integer> possibleBaddrQuarks = ss.getQuarks(String.valueOf(vpid), "*"); //$NON-NLS-1$
/* Get the most probable base address from all the known ones */
- NavigableSet<Long> possibleBaddrs = FluentIterable.from(possibleBaddrQuarks)
- .transform(new Function<Integer, Long>(){
- @Override
- public Long apply(@Nullable Integer quark) {
- String baddrStr = ss.getAttributeName(checkNotNull(quark).intValue());
- return checkNotNull(Long.valueOf(baddrStr));
- }
- }).toSortedSet(Ordering.natural());
+ NavigableSet<Long> possibleBaddrs = possibleBaddrQuarks.stream()
+ .map(quark -> {
+ String baddrStr = ss.getAttributeName(checkNotNull(quark).intValue());
+ return checkNotNull(Long.valueOf(baddrStr));
+ })
+ .collect(Collectors.toCollection(TreeSet::new));
+
final Long potentialBaddr = possibleBaddrs.floor(ip);
/* Make sure the 'ip' fits in the expected memory range */
* library was loaded there at that time.
*/
List<Integer> buildIds = ss.getSubAttributes(baddrQuark, false);
- Optional<Integer> potentialBuildIdQuark = FluentIterable.from(buildIds).firstMatch(new Predicate<Integer>() {
- @Override
- public boolean apply(@Nullable Integer input) {
- int quark = checkNotNull(input).intValue();
+ Optional<Integer> potentialBuildIdQuark = buildIds.stream()
+ .filter(id -> {
+ int quark = checkNotNull(id).intValue();
ITmfStateValue value = fullState.get(quark).getStateValue();
return (!value.isNull());
- }
- });
+ })
+ .findFirst();
if (!potentialBuildIdQuark.isPresent()) {
/* We didn't have the information after all. */
import org.eclipse.tracecompass.internal.tmf.remote.core.Activator;
import org.eclipse.tracecompass.internal.tmf.remote.core.messages.Messages;
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.collect.FluentIterable;
-
/**
* Factory for creation of remote connections programmatically.
*
if (manager == null) {
return null;
}
- FluentIterable<IRemoteConnection> connections = FluentIterable.from(manager.getAllRemoteConnections());
- Optional<IRemoteConnection> ret = connections.firstMatch(new Predicate<IRemoteConnection>() {
- @Override
- public boolean apply(@Nullable IRemoteConnection input) {
- return ((input != null) && input.getConnectionType().getId().equals(remoteServicesId.toString()) && input.getName().equals(name.toString()));
- }
- });
- return ret.orNull();
+ return manager.getAllRemoteConnections().stream()
+ .filter(connection ->
+ (connection != null) &&
+ connection.getConnectionType().getId().equals(remoteServicesId.toString()) &&
+ connection.getName().equals(name.toString()))
+ .findFirst()
+ .orElse(null);
}
/**
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
-import com.google.common.base.Function;
-import com.google.common.collect.FluentIterable;
-
/**
* Histogram-independent data model.
*
* @return an array of trace names
*/
public String[] getTraceNames() {
- FluentIterable<ITmfTrace> traces = FluentIterable.from(TmfTraceManager.getTraceSet(fTrace));
- FluentIterable<String> traceNames = traces.transform(new Function<ITmfTrace, String>() {
- @Override
- public String apply(ITmfTrace input) {
- return input.getName();
- }
- });
- return traceNames.toArray(String.class);
+ return TmfTraceManager.getTraceSet(fTrace).stream()
+ .map(trace -> trace.getName())
+ .toArray(String[]::new);
}
/**