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 7938495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:49:42+00:00 2026-06-03T22:49:42+00:00

I have a Seq of Tuple3 elements. I want a resulting collection (probably a

  • 0

I have a Seq of Tuple3 elements.
I want a resulting collection (probably a Set) made up with the second element of each tuple.

For example

(a, b, c), (d, e, f), (g, h, i) ==> (b, e, h)

Any idea? I searched a lot but all I’m finding has to do with filtering on the tuples, not within them, if that makes any sense.

I’m still quite new to Scala, learning is a long process 🙂 Thanks for your help.

  • 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-03T22:49:44+00:00Added an answer on June 3, 2026 at 10:49 pm

    yourSeqOfTuples.map(tuple => tuple._2).toSet, which may be shortedned to yourSeqOfTuples.map(_._2).toSet

    You may use {} rather than () if you prefer it so.
    _2 is the method which gets the second element of the tuple.

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

Sidebar

Related Questions

I have a seq<'A> . I want to map this to a seq<(int, 'A)>
I have a seq of seqs in FSharp . I want to join a
I have an xts object, for example ts=xts(seq(10),seq(Sys.Date(),Sys.Date()+10,length.out=10)) and need to add a new
I have tables, seq, triggers, sp, types, oracle queues etc. I want to know
I have created a sequence by cvCreateSequence now I want to add an element(a
Let's say I have the following tables tableA seq datea 1 2010-01-01 2 2010-02-01
I have these structs: typedef struct _Frag{ struct _Frag *next; char *seq; int x1;
I have a datset, which is dat<-matrix(seq(1:5290),c(115,46)) How can I convert dat to a
I have the dataset (pts) like this: x <- seq(-124.25,length=115,by=0.5) y <- seq(26.25,length=46,by=0.5) z
Edit originally the question was Collection to Tuple as I assumed I needed a

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.