Skip to content

redundant cast #184

@k1ngmang

Description

@k1ngmang

There is an redundant cast in the file com.spotify.mobius.Effects:

public static <F, G extends F> Set<F> effects(G... effects) {
    Set<F> result = new HashSet<>(effects.length);
    Collections.addAll(result, (F[]) Preconditions.checkArrayNoNulls((F[]) effects));

    return result;
  }

In this context, the cast does not make sense, and therefore can be written as follows:

public static <F, G extends F> Set<F> effects(G... effects) {
    Set<F> result = new HashSet<>(effects.length);
    Collections.addAll(result, Preconditions.checkArrayNoNulls((F[]) effects));

    return result;
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions