Right, indexOf for ByteString is defined by indexOf in GenSeqLike:

@return  the index of the first element of this $coll that is equal (as
determined by `==`) to `elem`, or `-1`, if none exists.

That means that the elem param can be of any type.

Slightly confusing, but not much we can do.

/Patrik


On Sun, Jun 8, 2014 at 2:45 PM, √iktor Ҡlang <[email protected]> wrote:

> (which also explains the String difference:
> http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#indexOf(java.lang.String)
> )
>
>
> On Sun, Jun 8, 2014 at 2:34 PM, √iktor Ҡlang <[email protected]>
> wrote:
>
>> Ah, nice catch Som
>>
>>
>> On Sun, Jun 8, 2014 at 1:28 PM, Som Snytt <[email protected]> wrote:
>>
>>> Ignoring the "use case", the doc says indexOf[B >: T] .
>>>
>>> I wonder why -Xlint doesn't warn, though.  Sometimes it warns about
>>> inferring Any.
>>>
>>>
>>>
>>> On Sun, Jun 8, 2014 at 3:23 AM, √iktor Ҡlang <[email protected]>
>>> wrote:
>>>
>>>> It is symmetric to:
>>>>
>>>>  val data = Array(0x37.toByte, 0x0A.toByte)
>>>>   assert(data.length == 2)
>>>>
>>>>   val bs = Array(0x0A.toByte)
>>>>   assert(bs.length == 1)
>>>>   assert(data.indexOf(bs(0)) == 1)
>>>>   assert(data.indexOfSlice(bs) == 1)
>>>>   assert(data.indexOf(bs) == -1)
>>>>
>>>> Right now I don't see where the indexOf-method comes from that is not
>>>> the element type but the container type.
>>>>
>>>>
>>>>
>>>> On Sat, Jun 7, 2014 at 11:10 AM, Alain Marcel <[email protected]> wrote:
>>>>
>>>>> Hi !
>>>>> Following assertions are all true.
>>>>> Why last one does not return 1 as with String :
>>>>> assert("ab".indexOf("b") == 1) ?
>>>>>
>>>>> Code :
>>>>>   val data = ByteString(0x37.toByte, 0x0A.toByte)
>>>>>   assert(data.length == 2)
>>>>>
>>>>>   val bs = ByteString(0x0A.toByte)
>>>>>   assert(bs.length == 1)
>>>>>   assert(data.indexOf(bs(0)) == 1)
>>>>>   assert(data.indexOfSlice(bs) == 1)
>>>>>   assert(data.indexOf(bs) == -1)
>>>>>
>>>>> Thanks,
>>>>> Alain
>>>>>
>>>>>
>>>>>  --
>>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>> >>>>>>>>>> Check the FAQ:
>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>> >>>>>>>>>> Search the archives:
>>>>> https://groups.google.com/group/akka-user
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Akka User List" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> To post to this group, send email to [email protected].
>>>>> Visit this group at http://groups.google.com/group/akka-user.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Cheers,
>>>> √
>>>>
>>>> --
>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>> >>>>>>>>>> Check the FAQ:
>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>> >>>>>>>>>> Search the archives:
>>>> https://groups.google.com/group/akka-user
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Akka User List" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To post to this group, send email to [email protected].
>>>> Visit this group at http://groups.google.com/group/akka-user.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>  --
>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>> >>>>>>>>>> Check the FAQ:
>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>> >>>>>>>>>> Search the archives:
>>> https://groups.google.com/group/akka-user
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Akka User List" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/akka-user.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Cheers,
>> √
>>
>
>
>
> --
> Cheers,
> √
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Patrik Nordwall
Typesafe <http://typesafe.com/> -  Reactive apps on the JVM
Twitter: @patriknw

<http://www.scaladays.org/>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to