Skip to content

Commit

Permalink
[#9633] Replace List with Map
Browse files Browse the repository at this point in the history
  • Loading branch information
emeroad committed Jan 13, 2023
1 parent dad8e43 commit 5aad118
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 173 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,31 @@
package com.navercorp.pinpoint.profiler.context.scope;

import com.navercorp.pinpoint.bootstrap.context.scope.TraceScope;
import com.navercorp.pinpoint.profiler.util.NameValueList;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
* @author jaehong.kim
*/
public class DefaultTraceScopePool {

private final NameValueList<TraceScope> list = new NameValueList<>();
private final Map<String, TraceScope> map = new HashMap<>();

public TraceScope get(String name) {
if (name == null) {
throw new IllegalArgumentException("name");
}
Objects.requireNonNull(name, "name");

return list.get(name);
return map.get(name);
}

public TraceScope add(String name) {
if (name == null) {
throw new IllegalArgumentException("name");
}
Objects.requireNonNull(name, "name");

final TraceScope oldScope = list.add(name, new DefaultTraceScope(name));
return oldScope;
return map.put(name, new DefaultTraceScope(name));
}

public void clear() {
list.clear();
map.clear();
}
}

This file was deleted.

This file was deleted.

0 comments on commit 5aad118

Please # to comment.