Github user zentol commented on the pull request:
https://github.com/apache/incubator-flink/pull/4#issuecomment-46497746
the loop could look like that right now, the encoding scheme wouldn't need to be changed.
if you want it character wise you could have something like this
```
...
for (int i = 0; i < Math.min(lengthFirst, lengthSecond); i++) {
byte[] char1 = readUnicodeCharAsByteArray(firstSource);
byte[] char2 = readUnicodeCharAsByteArray(secondSource);
int len = Math.min(char1.length, char2.length);
int cmp = 0;
for (int pos = 0; pos < len && (cmp = (char1[pos] - char2[pos])) == 0; pos++);
if (cmp != 0) {
return cmp;
}
}
...
```
if you want to read the whole string it would look like this
```
...
byte[] string1 = readUnicodeStringAsByteArray(firstSource);
byte[] string2 = readUnicodeStringAsByteArray(secondSource)
int len = Math.min(string1.length, string2.length);
int cmp = 0;
for (int pos = 0; pos < len && (cmp = (string1[pos] - string2[pos])) == 0; pos++);
if (cmp != 0) {
return cmp;
}
...
```
the string part can easily be split into several smaller parts.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at
[hidden email] or file a JIRA ticket
with INFRA.
---