question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support direct comparisons between byte[] and Bytes

See original GitHub issue

When comparing byte[] and Bytes, this currently requires an allocation and a copy. It would be nice to be able to do direct comparisons. To avoid copy+allocation, could possibly add the following methods to Bytes.

class Bytes {
   //note the method name contentEquals is used in String for types other than String
   public boolean contentEquals(byte[] bytes){...}
   public boolean contentEquals(byte[] bytes, int offset, int len){...}
   public int compareTo(byte[] bytes){...}
   public int compareTo(byte[] bytes, int offset, int len){...}
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
keith-turnercommented, Oct 2, 2017

@jkosh44 you need to fork the apache repo, push your changes to your fork, and then create a pull request. You are trying to push to the apache repo instead of your forked repo. If you have already forked look into the git remote add command. Also look into pushing to specific remote.

https://help.github.com/articles/fork-a-repo/ https://help.github.com/articles/about-pull-requests/

0reactions
jkosh44commented, Oct 3, 2017

Thanks, I missed that step. I made my fork, pushed my code, and a created pull request.

Read more comments on GitHub >

github_iconTop Results From Across the Web

When bandwidth and storage size matters: Bits vs. bytes
So, bits and bytes are both units of data, but what is the actual difference between them? One byte is equivalent to eight...
Read more >
What's the Difference Between a Word and a Byte? - Baeldung
Learn the characteristics of words and bytes and discussed their different relationships with memory and processors.
Read more >
Directly compare Two 8 Bit (1 Byte) values in C++
I'm wondering, is there a way to compare 8 bit values similarly to the way that we could compare an int? Yes, there...
Read more >
Understanding Bits and Bytes - Sewell Direct
A Byte is a collection of 8 bits; As you get into larger numbers of bits and bytes you start using prefixes, like...
Read more >
SmileDirectClub vs. Byte: An Honest Comparison - Smile Prep
Appearance Comparison. Both Byte and SmileDirectClub provide clear aligners that fit the contours of your teeth and are much less visible than ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found