Eclipzilla: Taking on the world Browing Flickr on TiVo
Feb 21

CharSequence: one of those quiet gems

Java, Tech Add comments

When is a String not a String?. Simon Harris has brought up the nice CharSequence interface that both Strings and StringBuffers implement.

This means that we can pass around the interface and let us give the implementation later.

Maybe it would be nice to have had ‘String’ be an interface itself, and when you coded: String foo = “bar” it would create an ImmutableString which implements String. Then we could come up with crazy implementations of String :)

However, we would run into a lot of security concerns, as people could sneak in BackdoorStringWhichEmailsMeYourPassword.

Anyway, CharSequence has been a very useful interface for me too, for those cases where I really do want to encapsulate multiple impls.

Leave a Reply

Spam is a pain, I am sorry to have to do this to you, but can you answer the question below?

Q: What is the number before 3? (just put in the digit)

Feb 21

CharSequence: one of those quiet gems

Java, Tech Add comments

When is a String not a String?. Simon Harris has brought up the nice CharSequence interface that both Strings and StringBuffers implement.

This means that we can pass around the interface and let us give the implementation later.

Maybe it would be nice to have had ‘String’ be an interface itself, and when you coded: String foo = “bar” it would create an ImmutableString which implements String. Then we could come up with crazy implementations of String :)

However, we would run into a lot of security concerns, as people could sneak in BackdoorStringWhichEmailsMeYourPassword.

Anyway, CharSequence has been a very useful interface for me too, for those cases where I really do want to encapsulate multiple impls.

Leave a Reply

Spam is a pain, I am sorry to have to do this to you, but can you answer the question below?

Q: What is the number before 3? (just put in the digit)