com.softicar.platform.common.container.array.ComparableByteArray Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of platform-common Show documentation
Show all versions of platform-common Show documentation
The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.
package com.softicar.platform.common.container.array;
import com.softicar.platform.common.container.comparing.ContainerComparing;
/**
* This adapter makes a byte array comparable to other byte arrays.
*
* @author Oliver Richers
*/
public class ComparableByteArray implements Comparable {
private final byte[] array;
public ComparableByteArray(byte[] array) {
this.array = array;
}
public static ComparableByteArray create(byte[] array) {
return new ComparableByteArray(array);
}
public byte[] get() {
return array;
}
@Override
public int compareTo(ComparableByteArray other) {
return ContainerComparing.compare(array, other.array);
}
}