Skip to content

Commit

Permalink
Leverage type inference for generics
Browse files Browse the repository at this point in the history
Use <> for type inference wherever applicable
  • Loading branch information
elsazac authored and akurtakov committed Jan 4, 2024
1 parent fe9b9f6 commit f1d24a6
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void handleStale(StaleEvent staleEvent) {
}

// One calendar per thread to preserve thread-safety
private static final ThreadLocal<Calendar> calendar = new ThreadLocal<Calendar>() {
private static final ThreadLocal<Calendar> calendar = new ThreadLocal<>() {
@Override
protected Calendar initialValue() {
return Calendar.getInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public boolean remove(Object o) {
Object key = unwrappedEntry.getKey();
final IdentityWrapper<Object> wrappedKey = IdentityWrapper
.wrap(key);
Map.Entry<IdentityWrapper<Object>, Object> wrappedEntry = new Map.Entry<IdentityWrapper<Object>, Object>() {
Map.Entry<IdentityWrapper<Object>, Object> wrappedEntry = new Map.Entry<>() {
@Override
public IdentityWrapper<Object> getKey() {
return wrappedKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class ListDelegatingValueObservableList<S, T extends S, E> extends Abstra
private DelegatingValueProperty<S, E> detailProperty;
private DelegatingCache<S, T, E> cache;

private IListChangeListener<T> masterListener = new IListChangeListener<T>() {
private IListChangeListener<T> masterListener = new IListChangeListener<>() {
@Override
public void handleListChange(ListChangeEvent<? extends T> event) {
if (isDisposed())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class ListSimpleValueObservableList<S, M extends S, T> extends AbstractOb

private boolean updating;

private IListChangeListener<M> masterListener = new IListChangeListener<M>() {
private IListChangeListener<M> masterListener = new IListChangeListener<>() {
@Override
public void handleListChange(ListChangeEvent<? extends M> event) {
if (!isDisposed()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class MapSimpleValueObservableMap<S, K, I extends S, V> extends AbstractO

private boolean updating = false;

private IMapChangeListener<K, I> masterListener = new IMapChangeListener<K, I>() {
private IMapChangeListener<K, I> masterListener = new IMapChangeListener<>() {
@Override
public void handleMapChange(final MapChangeEvent<? extends K, ? extends I> event) {
if (!isDisposed()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void handleValueChange(ValueChangeEvent<? extends T> event) {
}
};

private IValueChangeListener<M> modelChangeListener = new IValueChangeListener<M>() {
private IValueChangeListener<M> modelChangeListener = new IValueChangeListener<>() {
@Override
public void handleValueChange(ValueChangeEvent<? extends M> event) {
if (!updatingModel && !Util.equals(event.diff.getOldValue(), event.diff.getNewValue())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public boolean remove(Object o) {
final Entry<?, ?> unwrappedEntry = (Entry<?, ?>) o;
final ViewerElementWrapper<?> wrappedKey = new ViewerElementWrapper<>(unwrappedEntry.getKey(),
comparer);
Entry<Object, Object> wrappedEntry = new Entry<Object, Object>() {
Entry<Object, Object> wrappedEntry = new Entry<>() {
@Override
public Object getKey() {
return wrappedKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public OpenFolderAsProjectAction(IFolder folder, CommonViewer viewer) {

@Override
public void run() {
List<IProject> imported = new LinkedList<IProject>();
List<IProject> imported = new LinkedList<>();
JobGroup group = new JobGroup(WorkbenchNavigatorMessages.OpenProjectAction_multiple, 0, folders.size());
Job.getJobManager().addJobChangeListener(new GroupFinishedListener(group,
() -> reflectChanges(imported, folders.stream().map(IFolder::getParent).distinct().toList())));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ private void persistToModel(Scheme activeScheme) {

// weeds out any of the deleted system bindings using the binding
// manager
HashSet<Binding> activeBindings = new HashSet<Binding>(manager.getActiveBindingsDisregardingContextFlat());
HashSet<Binding> activeBindings = new HashSet<>(manager.getActiveBindingsDisregardingContextFlat());

// get all of the (active) model bindings that point to the actual runtime
// bindings
Expand Down

0 comments on commit f1d24a6

Please sign in to comment.