当前位置:网站首页>How do I check swift if two arrays contain the same elements, regardless of the order in which they appear?
How do I check swift if two arrays contain the same elements, regardless of the order in which they appear?
2022-06-25 06:24:00 【Bustling city 】
problem :
Let's say there are two arrays... Let's say there are two arrays ...
var array1 = ["a", "b", "c"]var array2 = ["b", "c", "a"]
I'd like the result of the comparison of these two arrays to be true, and the following... I hope the comparison between these two arrays is true , following ...
var array1 = ["a", "b", "c"]var array2 = ["b", "c", "a", "d"]
...to be false.…… fake .How can I achieve that in Swift? How can I be in Swift To achieve this ?I tried to convert both arrays to sets but for some reason Set() keeps removing some (usually duplicated) objects that the array contains. I tried to convert two arrays into collections , But for some reason Set() Keep deleting some of the... Contained in the array ( Usually repeated ) object .
Any help would be appreciated. Any help will be appreciated .
Solution :
Reference resources : https://stackoom.com/en/question/2U37i边栏推荐
- Forecast report on output demand and supply scale of global and Chinese structural ceramics market for semiconductor equipment (2022 Edition)
- [road of system analyst] collection of wrong questions in the chapters of Applied Mathematics and economic management
- JSON. toJSONString(object, SerializerFeature.WriteMapNullValue); Second parameter action
- Day22 send request and parameterization using JMeter
- Distributed solar photovoltaic inverter monitoring
- CST8227
- After five years of software testing in ByteDance, I was dismissed in December to remind my brother of paddling
- @Detailed explanation of valid annotation usage
- Location object
- No one reads the series. Source code analysis of copyonwritearraylist
猜你喜欢
BGP - basic concept
Uni app wechat applet customer service chat function
At the age of 26, I was transferred to software testing with zero foundation. Now I have successfully entered the job with a monthly salary of 12K. However, no one understands my bitterness
Getting started with Silverlight development 1
MySQL tuning --01--- optimization steps and system performance parameters
Getting started with mongodb
Guess the size of the number
What elements are indispensable for the development of the character? What are the stages
[Suanli network] problems and challenges faced by the development of Suanli network
JS to determine whether an element exists in the array (four methods)
随机推荐
PHP output (print) log to TXT text
[hand torn STL] Stack & queue
Huawei machine test question: splicing URL
MySQL tuning -- 02 -- slow query log
Processes and threads - concepts and process scheduling
Day21 performance test process
Go uses channel to control concurrency
RM command – remove file or directory
2022-02-19: fence installation. In a two-dimensional garden, there are some trees represented by (x, y) coordinates. As the installation cost is very expensive, your task is to enclose all the trees w
Report on the application prospect and investment potential of global and Chinese cell therapy industry 2022-2028
BGP - basic concept
Mongodb delete data
cacacahe
Echo command – output a string or extract the value of a shell variable
JD 7 head search navigation layout
How to use asemi FET 7n80 and how to use 7n80
Methods for obtaining some information of equipment
Lesson 8: FTP server setup and loading
C simple operation mongodb
Highway