Answer:
- import java.util.ArrayList;
- public class Main {
-
- public static void main(String[] args) {
- ArrayList<String> strList =new ArrayList<String>();
- strList.add("to");
- strList.add("be");
- strList.add("or");
- strList.add("not");
- strList.add("to");
- strList.add("be");
- strList.add("hamlet");
-
- swapPairs(strList);
- System.out.println(strList);
- }
-
- public static void swapPairs(ArrayList<String> list){
- for(int i=0; i < list.size()-1; i+=2){
- String temp = list.get(i);
- list.set(i, list.get(i+1));
- list.set(i+1, temp);
- }
- }
- }
Explanation:
Firstly, let's create a method swapPairs that take one ArrayList (Line 18). In the method, use a for-loop to traverse through each item in the ArrayList and swap the items between the current items at index-i and at index-i+1 (Line 19-22). The index-i is incremented by two in next loop and therefore the next swapping will proceed with third and fourth items and so forth.
In the main program, create a sample ArrayList (Line 5-12) and then test the method (Line 14) and print the output (Line 15). We shall get [be, to, not, or, be, to, hamlet].
Answer:
Online activities are increasingly used to make real-world decisions.
Explanation:
People use increasingly <em>world wide web</em>. They create profiles and communicate with others on social networks, share thoughts and moments of their life on online platforms.
These <em>online</em> activities become part of one's identity. Therefore these activities can give information about user's behaviors, attitudes, likes and dislikes.
All this data are being used to make real world decisions about a user or a group of users. For example, trough one's online check-ins, frequently used location of the users or can be determined. Similarly, trough social media likes or posts, one's hobbies can be predicted.
Therefore, social media and online presence in general, is not necessarily safe or private but important places which have valuable information of the users that can be used in real world.
Hello <span>Dariysss2033 </span>
Question: <span>Which toolbar option in a word processor enables you to copy the formatting applied to a section of text, and apply that formatting to another section in the document?
</span><span>
Answer: Paint Format
Hope This Helps!
-Chris</span>
Nazlian monsters died and died and died again of heart attack