Skip to content

Commit c154b6c

Browse files
committed
#180 improve comparison in Triple
1 parent 5143c53 commit c154b6c

File tree

1 file changed

+3
-1
lines changed
  • org.openwms.core.util/src/main/java/org/openwms/core/lang

1 file changed

+3
-1
lines changed

org.openwms.core.util/src/main/java/org/openwms/core/lang/Triple.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
package org.openwms.core.lang;
1717

18+
import java.util.Objects;
19+
1820
/**
1921
* A Triple.
2022
*
@@ -32,7 +34,7 @@ public record Triple<K, V, T>(K key, V value, T type) {
3234
*/
3335
@SuppressWarnings("unchecked")
3436
public <U> U valueAs(Class<U> clazz) {
35-
if (clazz.equals(this.type.getClass())) {
37+
if (Objects.equals(this.type.getClass().getComponentType(), clazz.getComponentType())) {
3638
return (U) value;
3739
}
3840
throw new ClassCastException("Cannot case requested type [%s] from [%s]".formatted(clazz, type.getClass()));

0 commit comments

Comments
 (0)