All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cdc.util.pstrings.PackedStringN Maven / Gradle / Ivy

There is a newer version: 0.6.0
Show newest version
package cdc.util.pstrings;

import java.util.Arrays;

final class PackedStringN extends PackedString {
    private final byte[] bytes;

    public PackedStringN(byte[] bytes) {
        this.bytes = new byte[bytes.length];
        for (int index = 0; index < bytes.length; index++) {
            this.bytes[index] = bytes[index];
        }
    }

    @Override
    protected byte[] toBytes() {
        return bytes;
    }

    @Override
    public boolean equals(Object other) {
        if (this == other) {
            return true;
        }
        if (other == null || getClass() != other.getClass()) {
            return false;
        }
        final PackedStringN o = (PackedStringN) other;
        return Arrays.equals(bytes, o.bytes);
    }

    @Override
    public int hashCode() {
        int result = 0;
        for (final byte b : bytes) {
            result = 31 * result + b;
        }
        return result;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy