Created
December 11, 2015 12:14
-
-
Save freakboy3742/03e050ac573b57ede73b to your computer and use it in GitHub Desktop.
Another VOC milestone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyStringAnalog(implements=java.lang.CharSequence): | |
def __init__(self, value): | |
self.value = value | |
def charAt(self, index: int) -> char: | |
return 'x' | |
def length(self) -> int: | |
return len(self.value) | |
def subSequence(self, start: int, end: int) -> java.lang.CharSequence: | |
return MyStringAnalog(self.value[start:end]) | |
def toString(self) -> java.lang.String: | |
return self.value | |
from java.lang import StringBuilder | |
builder = StringBuilder() | |
builder.append("Hello, ") | |
analog = MyStringAnalog("world") | |
builder.append(analog) | |
print(builder) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should
charAt
not returnself.value[index]
?