Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8198389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:56:27+00:00 2026-06-07T05:56:27+00:00

Here is the piece of code in question: val oauth_params = IMap( oauth_consumer_key ->

  • 0

Here is the piece of code in question:

val oauth_params = IMap(
      "oauth_consumer_key" -> consumer.key,
      "oauth_signature_method" -> "HMAC-SHA1",
      "oauth_timestamp" -> (System.currentTimeMillis / 1000).toString,
      "oauth_nonce" -> System.nanoTime.toString
    ) ++ token.map { "oauth_token" -> _.value } ++
      verifier.map { "oauth_verifier" -> _ }

Question 1: What Scala feature enabled "oauth_consumer_key" -> consumer.key to exist and passed as arguments?

Question 2: Seeing val oauth_params = IMap(...) and token.map {...}, which operations use {} for passing values rather than the usual ()? Are there specific rules? And why is the for loop allowed to use both, if it is a related issue?

I ask here as I saw the features being used elsewhere. I also believe that both questions are related.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T05:56:28+00:00Added an answer on June 7, 2026 at 5:56 am

    In order:

    -> is defined in Predef.scala, which is imported inside any other Scala source during the compilation:

    final class ArrowAssoc[A](val x: A) {
      @inline def -> [B](y: B): Tuple2[A, B] = Tuple2(x, y)
      def →[B](y: B): Tuple2[A, B] = ->(y)
    }
    implicit def any2ArrowAssoc[A](x: A): ArrowAssoc[A] = new ArrowAssoc(x)
    

    As you can see, there is an implicit conversion that convert any object into an ArrowAssoc[A], which has a method ->[B] which returns a Tuple2[A,B].

    IMap(…) it’s the call to the method IMap.apply(…) : in Scala if a method is named apply, you can omit it. In this case, it is used as a factory method in a very common pattern in Scala

    class MyClass(....) {
    
    }
    object MyClass{ 
       def apply(....): MyClass = new MyClass(....)
    }
    
    val a = MyClass(a,b,c)
    

    What you just saw is a Scala class and its companion object: a singleton which has to be defined in the same source file as the class and which can also access private and protected fields in the the class itself

    The map function receives a function which takes the same type of the collection and returns a different type. Example: List(1,2,3).map ( x => x * 2). ( ) and { } are interchangeable in Scala excepts with the case construct.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

my first question here! I have a problem with a piece of code that
Here's the code in question: parentNodes.AsParallel().ForAll(parent => { List<Piece> plist = parent.Field.GetValidOrientations(pieceQueue[parent.Level]); plist.ForEach(p =>
Here is my piece of code that creates buttons programmatically: NSArray *buttonImage=[NSArray arrayWithObjects:[UIImage imageNamed:@Cover_0.png],
Here a small piece of code for testing and explain the problem. I have
Here I have piece of code, showing example of how I want to update
Here is the piece of code that I have used for Java 5.0 TreeSet<Integer>
Here's a piece of code from the xss_clean method of the Input_Core class of
Here's a piece of code that takes most time in my program, according to
Here's a piece of code, currently driving me nuts. It's a UIView, with an
a piece of code here jmp_buf mark; int Sub_Func() { int be_modify, jmpret; be_modify

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.