Pattern CharSequence Question.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Pattern CharSequence Question.

Zachary1234-2
[b]Do the classes java.util.regex.Pattern and java.util.regex.Match ,
despite java's lake of pointers and references, work upon
a reference to the CharSequence string, or a full copy?[/b]

I've been able to generate exceptions in pattern matching by setting
the submit search string to null afterwards, and I might like to know
why.

?




Reply | Threaded
Open this post in threaded view
|

Re: Pattern CharSequence Question.

Simon Roberts-4
Every variable,except of the 8 primitive types, is a reference.

On Sep 27, 2017 01:22, "Zachary1234" <[hidden email]> wrote:
[b]Do the classes java.util.regex.Pattern and java.util.regex.Match ,
despite java's lake of pointers and references, work upon
a reference to the CharSequence string, or a full copy?[/b]

I've been able to generate exceptions in pattern matching by setting
the submit search string to null afterwards, and I might like to know
why.

?




Reply | Threaded
Open this post in threaded view
|

Re: Pattern CharSequence Question.

Eduard
In reply to this post by Zachary1234-2
This is too unspecific to respond to.
An Object with CharSequence as type is effectively a read-only data
structure,fundamentally, the only thing you can do with it is access a
character at a particular position.  A String is also a CharSequence,
and it is immutable. In neither case would need making a copy to scan
the text an instance contains.

I think you are looking in the wrong direction to find out what happens,
the concept of a pointer is completely irrelevant in thinking about
Java. An object is an object and it is passed into a method as just
that. How the passing is done is of no concern in any errors that may
arise.

Please provide the exceptions and a minimal scenario on how to get these
exception(s). Then it might be possible to find what is happening.

Cheers
Eduard

Zachary1234 wrote:

> [b]Do the classes java.util.regex.Pattern and java.util.regex.Match ,
> despite java's lake of pointers and references, work upon
> a reference to the CharSequence string, or a full copy?[/b]
>
> I've been able to generate exceptions in pattern matching by setting
> the submit search string to null afterwards, and I might like to know
> why.
>
> ?
>
>
>
>
>