Question
All answers must start with a way to source a stream, followed by a single sequence of ONLY stream operations including collect and any operation
All answers must start with a way to source a stream, followed by a single sequence of ONLY stream operations including collect and any operation on Optional
For each answer, the result MUST be assigned to a name and typed variable:
EG:Integer res = ....sequence of stream operations...
res (name) is the result variable of INTEGER (type)
Question 1 Part 1
In a document doc.txt, count the unique words (case insensitive) by length, i.e. how many unique words of what length.
For example, 3 words of lenth 4, 5 words of length 3, etc.
Assume a word is a sequence of non-space characters and each line in the document contains one or more words.
Part 2
Consider an nx2 array, double[][] arr, in which each of the 2 columns represents a vector. Write code to get the dot product of the column vectors, i.e. the sum of products of corresponding items.
EG:
[1,2,3]*[4,5,6] = 1*4 + 2*5 + 3*6 = 32
Please show all work and explain the solution
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started