Fix some null warnings
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.core / src / org / eclipse / tracecompass / tmf / core / trace / TmfEventTypeCollectionHelper.java
1 /*******************************************************************************
2 * Copyright (c) 2014 Ericsson
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Matthew Khouzam - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.tracecompass.tmf.core.trace;
14
15 import java.util.HashSet;
16 import java.util.Set;
17
18 import org.eclipse.jdt.annotation.NonNull;
19 import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
20
21 /**
22 * Set Helper for sets of ITmfTraceType
23 *
24 * TODO Remove once Java 8 is used (replace with Streams)
25 *
26 * @author Matthew Khouzam
27 */
28 public final class TmfEventTypeCollectionHelper {
29
30 private TmfEventTypeCollectionHelper() {
31 }
32
33 /**
34 * Gets the event names from a collection of event types
35 *
36 * @param eventTypes
37 * an iterable collection of ITmfEventTypes
38 * @return a set of the names of these events, if some names are clashing
39 * they will only appear once
40 */
41 public static Set<@NonNull String> getEventNames(Iterable<@NonNull ? extends ITmfEventType> eventTypes) {
42 Set<@NonNull String> retSet = new HashSet<>();
43 for (ITmfEventType eventType : eventTypes) {
44 retSet.add(eventType.getName());
45 }
46 return retSet;
47 }
48 }
This page took 0.031255 seconds and 5 git commands to generate.