Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#9633] Replace List with Map #9634

Merged
merged 1 commit into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.