No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UnsafeParallelHashSetExtensions.gen.cs 87KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281
  1. using System;
  2. using Unity.Collections.LowLevel.Unsafe;
  3. namespace Unity.Collections.LowLevel.Unsafe
  4. {
  5. /// <summary>
  6. /// Provides extension methods for sets.
  7. /// </summary>
  8. public unsafe static class HashSetExtensions
  9. {
  10. /// <summary>
  11. /// Removes the values from this set which are also present in another collection.
  12. /// </summary>
  13. /// <typeparam name="T">The type of values.</typeparam>
  14. /// <param name="container">The set to remove values from.</param>
  15. /// <param name="other">The collection to compare with.</param>
  16. public static void ExceptWith<T>(this ref NativeHashSet<T> container, UnsafeHashSet<T> other)
  17. where T : unmanaged, IEquatable<T>
  18. {
  19. foreach (var item in other)
  20. {
  21. container.Remove(item);
  22. }
  23. }
  24. /// <summary>
  25. /// Removes the values from this set which are absent in another collection.
  26. /// </summary>
  27. /// <typeparam name="T">The type of values.</typeparam>
  28. /// <param name="container">The set to remove values from.</param>
  29. /// <param name="other">The collection to compare with.</param>
  30. public static void IntersectWith<T>(this ref NativeHashSet<T> container, UnsafeHashSet<T> other)
  31. where T : unmanaged, IEquatable<T>
  32. {
  33. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  34. foreach (var item in other)
  35. {
  36. if (container.Contains(item))
  37. {
  38. result.Add(item);
  39. }
  40. }
  41. container.Clear();
  42. container.UnionWith(result);
  43. result.Dispose();
  44. }
  45. /// <summary>
  46. /// Adds all values from a collection to this set.
  47. /// </summary>
  48. /// <typeparam name="T">The type of values.</typeparam>
  49. /// <param name="container">The set to add values to.</param>
  50. /// <param name="other">The collection to copy values from.</param>
  51. public static void UnionWith<T>(this ref NativeHashSet<T> container, UnsafeHashSet<T> other)
  52. where T : unmanaged, IEquatable<T>
  53. {
  54. foreach (var item in other)
  55. {
  56. container.Add(item);
  57. }
  58. }
  59. /// <summary>
  60. /// Removes the values from this set which are also present in another collection.
  61. /// </summary>
  62. /// <typeparam name="T">The type of values.</typeparam>
  63. /// <param name="container">The set to remove values from.</param>
  64. /// <param name="other">The collection to compare with.</param>
  65. public static void ExceptWith<T>(this ref NativeHashSet<T> container, UnsafeHashSet<T>.ReadOnly other)
  66. where T : unmanaged, IEquatable<T>
  67. {
  68. foreach (var item in other)
  69. {
  70. container.Remove(item);
  71. }
  72. }
  73. /// <summary>
  74. /// Removes the values from this set which are absent in another collection.
  75. /// </summary>
  76. /// <typeparam name="T">The type of values.</typeparam>
  77. /// <param name="container">The set to remove values from.</param>
  78. /// <param name="other">The collection to compare with.</param>
  79. public static void IntersectWith<T>(this ref NativeHashSet<T> container, UnsafeHashSet<T>.ReadOnly other)
  80. where T : unmanaged, IEquatable<T>
  81. {
  82. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  83. foreach (var item in other)
  84. {
  85. if (container.Contains(item))
  86. {
  87. result.Add(item);
  88. }
  89. }
  90. container.Clear();
  91. container.UnionWith(result);
  92. result.Dispose();
  93. }
  94. /// <summary>
  95. /// Adds all values from a collection to this set.
  96. /// </summary>
  97. /// <typeparam name="T">The type of values.</typeparam>
  98. /// <param name="container">The set to add values to.</param>
  99. /// <param name="other">The collection to copy values from.</param>
  100. public static void UnionWith<T>(this ref NativeHashSet<T> container, UnsafeHashSet<T>.ReadOnly other)
  101. where T : unmanaged, IEquatable<T>
  102. {
  103. foreach (var item in other)
  104. {
  105. container.Add(item);
  106. }
  107. }
  108. /// <summary>
  109. /// Removes the values from this set which are also present in another collection.
  110. /// </summary>
  111. /// <typeparam name="T">The type of values.</typeparam>
  112. /// <param name="container">The set to remove values from.</param>
  113. /// <param name="other">The collection to compare with.</param>
  114. public static void ExceptWith<T>(this ref NativeHashSet<T> container, UnsafeParallelHashSet<T> other)
  115. where T : unmanaged, IEquatable<T>
  116. {
  117. foreach (var item in other)
  118. {
  119. container.Remove(item);
  120. }
  121. }
  122. /// <summary>
  123. /// Removes the values from this set which are absent in another collection.
  124. /// </summary>
  125. /// <typeparam name="T">The type of values.</typeparam>
  126. /// <param name="container">The set to remove values from.</param>
  127. /// <param name="other">The collection to compare with.</param>
  128. public static void IntersectWith<T>(this ref NativeHashSet<T> container, UnsafeParallelHashSet<T> other)
  129. where T : unmanaged, IEquatable<T>
  130. {
  131. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  132. foreach (var item in other)
  133. {
  134. if (container.Contains(item))
  135. {
  136. result.Add(item);
  137. }
  138. }
  139. container.Clear();
  140. container.UnionWith(result);
  141. result.Dispose();
  142. }
  143. /// <summary>
  144. /// Adds all values from a collection to this set.
  145. /// </summary>
  146. /// <typeparam name="T">The type of values.</typeparam>
  147. /// <param name="container">The set to add values to.</param>
  148. /// <param name="other">The collection to copy values from.</param>
  149. public static void UnionWith<T>(this ref NativeHashSet<T> container, UnsafeParallelHashSet<T> other)
  150. where T : unmanaged, IEquatable<T>
  151. {
  152. foreach (var item in other)
  153. {
  154. container.Add(item);
  155. }
  156. }
  157. /// <summary>
  158. /// Removes the values from this set which are also present in another collection.
  159. /// </summary>
  160. /// <typeparam name="T">The type of values.</typeparam>
  161. /// <param name="container">The set to remove values from.</param>
  162. /// <param name="other">The collection to compare with.</param>
  163. public static void ExceptWith<T>(this ref NativeHashSet<T> container, UnsafeParallelHashSet<T>.ReadOnly other)
  164. where T : unmanaged, IEquatable<T>
  165. {
  166. foreach (var item in other)
  167. {
  168. container.Remove(item);
  169. }
  170. }
  171. /// <summary>
  172. /// Removes the values from this set which are absent in another collection.
  173. /// </summary>
  174. /// <typeparam name="T">The type of values.</typeparam>
  175. /// <param name="container">The set to remove values from.</param>
  176. /// <param name="other">The collection to compare with.</param>
  177. public static void IntersectWith<T>(this ref NativeHashSet<T> container, UnsafeParallelHashSet<T>.ReadOnly other)
  178. where T : unmanaged, IEquatable<T>
  179. {
  180. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  181. foreach (var item in other)
  182. {
  183. if (container.Contains(item))
  184. {
  185. result.Add(item);
  186. }
  187. }
  188. container.Clear();
  189. container.UnionWith(result);
  190. result.Dispose();
  191. }
  192. /// <summary>
  193. /// Adds all values from a collection to this set.
  194. /// </summary>
  195. /// <typeparam name="T">The type of values.</typeparam>
  196. /// <param name="container">The set to add values to.</param>
  197. /// <param name="other">The collection to copy values from.</param>
  198. public static void UnionWith<T>(this ref NativeHashSet<T> container, UnsafeParallelHashSet<T>.ReadOnly other)
  199. where T : unmanaged, IEquatable<T>
  200. {
  201. foreach (var item in other)
  202. {
  203. container.Add(item);
  204. }
  205. }
  206. /// <summary>
  207. /// Removes the values from this set which are also present in another collection.
  208. /// </summary>
  209. /// <typeparam name="T">The type of values.</typeparam>
  210. /// <param name="container">The set to remove values from.</param>
  211. /// <param name="other">The collection to compare with.</param>
  212. public static void ExceptWith<T>(this ref NativeHashSet<T> container, UnsafeList<T> other)
  213. where T : unmanaged, IEquatable<T>
  214. {
  215. foreach (var item in other)
  216. {
  217. container.Remove(item);
  218. }
  219. }
  220. /// <summary>
  221. /// Removes the values from this set which are absent in another collection.
  222. /// </summary>
  223. /// <typeparam name="T">The type of values.</typeparam>
  224. /// <param name="container">The set to remove values from.</param>
  225. /// <param name="other">The collection to compare with.</param>
  226. public static void IntersectWith<T>(this ref NativeHashSet<T> container, UnsafeList<T> other)
  227. where T : unmanaged, IEquatable<T>
  228. {
  229. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  230. foreach (var item in other)
  231. {
  232. if (container.Contains(item))
  233. {
  234. result.Add(item);
  235. }
  236. }
  237. container.Clear();
  238. container.UnionWith(result);
  239. result.Dispose();
  240. }
  241. /// <summary>
  242. /// Adds all values from a collection to this set.
  243. /// </summary>
  244. /// <typeparam name="T">The type of values.</typeparam>
  245. /// <param name="container">The set to add values to.</param>
  246. /// <param name="other">The collection to copy values from.</param>
  247. public static void UnionWith<T>(this ref NativeHashSet<T> container, UnsafeList<T> other)
  248. where T : unmanaged, IEquatable<T>
  249. {
  250. foreach (var item in other)
  251. {
  252. container.Add(item);
  253. }
  254. }
  255. /// <summary>
  256. /// Removes the values from this set which are also present in another collection.
  257. /// </summary>
  258. /// <typeparam name="T">The type of values.</typeparam>
  259. /// <param name="container">The set to remove values from.</param>
  260. /// <param name="other">The collection to compare with.</param>
  261. public static void ExceptWith<T>(this ref NativeParallelHashSet<T> container, UnsafeHashSet<T> other)
  262. where T : unmanaged, IEquatable<T>
  263. {
  264. foreach (var item in other)
  265. {
  266. container.Remove(item);
  267. }
  268. }
  269. /// <summary>
  270. /// Removes the values from this set which are absent in another collection.
  271. /// </summary>
  272. /// <typeparam name="T">The type of values.</typeparam>
  273. /// <param name="container">The set to remove values from.</param>
  274. /// <param name="other">The collection to compare with.</param>
  275. public static void IntersectWith<T>(this ref NativeParallelHashSet<T> container, UnsafeHashSet<T> other)
  276. where T : unmanaged, IEquatable<T>
  277. {
  278. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  279. foreach (var item in other)
  280. {
  281. if (container.Contains(item))
  282. {
  283. result.Add(item);
  284. }
  285. }
  286. container.Clear();
  287. container.UnionWith(result);
  288. result.Dispose();
  289. }
  290. /// <summary>
  291. /// Adds all values from a collection to this set.
  292. /// </summary>
  293. /// <typeparam name="T">The type of values.</typeparam>
  294. /// <param name="container">The set to add values to.</param>
  295. /// <param name="other">The collection to copy values from.</param>
  296. public static void UnionWith<T>(this ref NativeParallelHashSet<T> container, UnsafeHashSet<T> other)
  297. where T : unmanaged, IEquatable<T>
  298. {
  299. foreach (var item in other)
  300. {
  301. container.Add(item);
  302. }
  303. }
  304. /// <summary>
  305. /// Removes the values from this set which are also present in another collection.
  306. /// </summary>
  307. /// <typeparam name="T">The type of values.</typeparam>
  308. /// <param name="container">The set to remove values from.</param>
  309. /// <param name="other">The collection to compare with.</param>
  310. public static void ExceptWith<T>(this ref NativeParallelHashSet<T> container, UnsafeHashSet<T>.ReadOnly other)
  311. where T : unmanaged, IEquatable<T>
  312. {
  313. foreach (var item in other)
  314. {
  315. container.Remove(item);
  316. }
  317. }
  318. /// <summary>
  319. /// Removes the values from this set which are absent in another collection.
  320. /// </summary>
  321. /// <typeparam name="T">The type of values.</typeparam>
  322. /// <param name="container">The set to remove values from.</param>
  323. /// <param name="other">The collection to compare with.</param>
  324. public static void IntersectWith<T>(this ref NativeParallelHashSet<T> container, UnsafeHashSet<T>.ReadOnly other)
  325. where T : unmanaged, IEquatable<T>
  326. {
  327. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  328. foreach (var item in other)
  329. {
  330. if (container.Contains(item))
  331. {
  332. result.Add(item);
  333. }
  334. }
  335. container.Clear();
  336. container.UnionWith(result);
  337. result.Dispose();
  338. }
  339. /// <summary>
  340. /// Adds all values from a collection to this set.
  341. /// </summary>
  342. /// <typeparam name="T">The type of values.</typeparam>
  343. /// <param name="container">The set to add values to.</param>
  344. /// <param name="other">The collection to copy values from.</param>
  345. public static void UnionWith<T>(this ref NativeParallelHashSet<T> container, UnsafeHashSet<T>.ReadOnly other)
  346. where T : unmanaged, IEquatable<T>
  347. {
  348. foreach (var item in other)
  349. {
  350. container.Add(item);
  351. }
  352. }
  353. /// <summary>
  354. /// Removes the values from this set which are also present in another collection.
  355. /// </summary>
  356. /// <typeparam name="T">The type of values.</typeparam>
  357. /// <param name="container">The set to remove values from.</param>
  358. /// <param name="other">The collection to compare with.</param>
  359. public static void ExceptWith<T>(this ref NativeParallelHashSet<T> container, UnsafeParallelHashSet<T> other)
  360. where T : unmanaged, IEquatable<T>
  361. {
  362. foreach (var item in other)
  363. {
  364. container.Remove(item);
  365. }
  366. }
  367. /// <summary>
  368. /// Removes the values from this set which are absent in another collection.
  369. /// </summary>
  370. /// <typeparam name="T">The type of values.</typeparam>
  371. /// <param name="container">The set to remove values from.</param>
  372. /// <param name="other">The collection to compare with.</param>
  373. public static void IntersectWith<T>(this ref NativeParallelHashSet<T> container, UnsafeParallelHashSet<T> other)
  374. where T : unmanaged, IEquatable<T>
  375. {
  376. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  377. foreach (var item in other)
  378. {
  379. if (container.Contains(item))
  380. {
  381. result.Add(item);
  382. }
  383. }
  384. container.Clear();
  385. container.UnionWith(result);
  386. result.Dispose();
  387. }
  388. /// <summary>
  389. /// Adds all values from a collection to this set.
  390. /// </summary>
  391. /// <typeparam name="T">The type of values.</typeparam>
  392. /// <param name="container">The set to add values to.</param>
  393. /// <param name="other">The collection to copy values from.</param>
  394. public static void UnionWith<T>(this ref NativeParallelHashSet<T> container, UnsafeParallelHashSet<T> other)
  395. where T : unmanaged, IEquatable<T>
  396. {
  397. foreach (var item in other)
  398. {
  399. container.Add(item);
  400. }
  401. }
  402. /// <summary>
  403. /// Removes the values from this set which are also present in another collection.
  404. /// </summary>
  405. /// <typeparam name="T">The type of values.</typeparam>
  406. /// <param name="container">The set to remove values from.</param>
  407. /// <param name="other">The collection to compare with.</param>
  408. public static void ExceptWith<T>(this ref NativeParallelHashSet<T> container, UnsafeParallelHashSet<T>.ReadOnly other)
  409. where T : unmanaged, IEquatable<T>
  410. {
  411. foreach (var item in other)
  412. {
  413. container.Remove(item);
  414. }
  415. }
  416. /// <summary>
  417. /// Removes the values from this set which are absent in another collection.
  418. /// </summary>
  419. /// <typeparam name="T">The type of values.</typeparam>
  420. /// <param name="container">The set to remove values from.</param>
  421. /// <param name="other">The collection to compare with.</param>
  422. public static void IntersectWith<T>(this ref NativeParallelHashSet<T> container, UnsafeParallelHashSet<T>.ReadOnly other)
  423. where T : unmanaged, IEquatable<T>
  424. {
  425. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  426. foreach (var item in other)
  427. {
  428. if (container.Contains(item))
  429. {
  430. result.Add(item);
  431. }
  432. }
  433. container.Clear();
  434. container.UnionWith(result);
  435. result.Dispose();
  436. }
  437. /// <summary>
  438. /// Adds all values from a collection to this set.
  439. /// </summary>
  440. /// <typeparam name="T">The type of values.</typeparam>
  441. /// <param name="container">The set to add values to.</param>
  442. /// <param name="other">The collection to copy values from.</param>
  443. public static void UnionWith<T>(this ref NativeParallelHashSet<T> container, UnsafeParallelHashSet<T>.ReadOnly other)
  444. where T : unmanaged, IEquatable<T>
  445. {
  446. foreach (var item in other)
  447. {
  448. container.Add(item);
  449. }
  450. }
  451. /// <summary>
  452. /// Removes the values from this set which are also present in another collection.
  453. /// </summary>
  454. /// <typeparam name="T">The type of values.</typeparam>
  455. /// <param name="container">The set to remove values from.</param>
  456. /// <param name="other">The collection to compare with.</param>
  457. public static void ExceptWith<T>(this ref NativeParallelHashSet<T> container, UnsafeList<T> other)
  458. where T : unmanaged, IEquatable<T>
  459. {
  460. foreach (var item in other)
  461. {
  462. container.Remove(item);
  463. }
  464. }
  465. /// <summary>
  466. /// Removes the values from this set which are absent in another collection.
  467. /// </summary>
  468. /// <typeparam name="T">The type of values.</typeparam>
  469. /// <param name="container">The set to remove values from.</param>
  470. /// <param name="other">The collection to compare with.</param>
  471. public static void IntersectWith<T>(this ref NativeParallelHashSet<T> container, UnsafeList<T> other)
  472. where T : unmanaged, IEquatable<T>
  473. {
  474. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  475. foreach (var item in other)
  476. {
  477. if (container.Contains(item))
  478. {
  479. result.Add(item);
  480. }
  481. }
  482. container.Clear();
  483. container.UnionWith(result);
  484. result.Dispose();
  485. }
  486. /// <summary>
  487. /// Adds all values from a collection to this set.
  488. /// </summary>
  489. /// <typeparam name="T">The type of values.</typeparam>
  490. /// <param name="container">The set to add values to.</param>
  491. /// <param name="other">The collection to copy values from.</param>
  492. public static void UnionWith<T>(this ref NativeParallelHashSet<T> container, UnsafeList<T> other)
  493. where T : unmanaged, IEquatable<T>
  494. {
  495. foreach (var item in other)
  496. {
  497. container.Add(item);
  498. }
  499. }
  500. /// <summary>
  501. /// Removes the values from this set which are also present in another collection.
  502. /// </summary>
  503. /// <typeparam name="T">The type of values.</typeparam>
  504. /// <param name="container">The set to remove values from.</param>
  505. /// <param name="other">The collection to compare with.</param>
  506. public static void ExceptWith<T>(this ref UnsafeHashSet<T> container, FixedList128Bytes<T> other)
  507. where T : unmanaged, IEquatable<T>
  508. {
  509. foreach (var item in other)
  510. {
  511. container.Remove(item);
  512. }
  513. }
  514. /// <summary>
  515. /// Removes the values from this set which are absent in another collection.
  516. /// </summary>
  517. /// <typeparam name="T">The type of values.</typeparam>
  518. /// <param name="container">The set to remove values from.</param>
  519. /// <param name="other">The collection to compare with.</param>
  520. public static void IntersectWith<T>(this ref UnsafeHashSet<T> container, FixedList128Bytes<T> other)
  521. where T : unmanaged, IEquatable<T>
  522. {
  523. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  524. foreach (var item in other)
  525. {
  526. if (container.Contains(item))
  527. {
  528. result.Add(item);
  529. }
  530. }
  531. container.Clear();
  532. container.UnionWith(result);
  533. result.Dispose();
  534. }
  535. /// <summary>
  536. /// Adds all values from a collection to this set.
  537. /// </summary>
  538. /// <typeparam name="T">The type of values.</typeparam>
  539. /// <param name="container">The set to add values to.</param>
  540. /// <param name="other">The collection to copy values from.</param>
  541. public static void UnionWith<T>(this ref UnsafeHashSet<T> container, FixedList128Bytes<T> other)
  542. where T : unmanaged, IEquatable<T>
  543. {
  544. foreach (var item in other)
  545. {
  546. container.Add(item);
  547. }
  548. }
  549. /// <summary>
  550. /// Removes the values from this set which are also present in another collection.
  551. /// </summary>
  552. /// <typeparam name="T">The type of values.</typeparam>
  553. /// <param name="container">The set to remove values from.</param>
  554. /// <param name="other">The collection to compare with.</param>
  555. public static void ExceptWith<T>(this ref UnsafeHashSet<T> container, FixedList32Bytes<T> other)
  556. where T : unmanaged, IEquatable<T>
  557. {
  558. foreach (var item in other)
  559. {
  560. container.Remove(item);
  561. }
  562. }
  563. /// <summary>
  564. /// Removes the values from this set which are absent in another collection.
  565. /// </summary>
  566. /// <typeparam name="T">The type of values.</typeparam>
  567. /// <param name="container">The set to remove values from.</param>
  568. /// <param name="other">The collection to compare with.</param>
  569. public static void IntersectWith<T>(this ref UnsafeHashSet<T> container, FixedList32Bytes<T> other)
  570. where T : unmanaged, IEquatable<T>
  571. {
  572. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  573. foreach (var item in other)
  574. {
  575. if (container.Contains(item))
  576. {
  577. result.Add(item);
  578. }
  579. }
  580. container.Clear();
  581. container.UnionWith(result);
  582. result.Dispose();
  583. }
  584. /// <summary>
  585. /// Adds all values from a collection to this set.
  586. /// </summary>
  587. /// <typeparam name="T">The type of values.</typeparam>
  588. /// <param name="container">The set to add values to.</param>
  589. /// <param name="other">The collection to copy values from.</param>
  590. public static void UnionWith<T>(this ref UnsafeHashSet<T> container, FixedList32Bytes<T> other)
  591. where T : unmanaged, IEquatable<T>
  592. {
  593. foreach (var item in other)
  594. {
  595. container.Add(item);
  596. }
  597. }
  598. /// <summary>
  599. /// Removes the values from this set which are also present in another collection.
  600. /// </summary>
  601. /// <typeparam name="T">The type of values.</typeparam>
  602. /// <param name="container">The set to remove values from.</param>
  603. /// <param name="other">The collection to compare with.</param>
  604. public static void ExceptWith<T>(this ref UnsafeHashSet<T> container, FixedList4096Bytes<T> other)
  605. where T : unmanaged, IEquatable<T>
  606. {
  607. foreach (var item in other)
  608. {
  609. container.Remove(item);
  610. }
  611. }
  612. /// <summary>
  613. /// Removes the values from this set which are absent in another collection.
  614. /// </summary>
  615. /// <typeparam name="T">The type of values.</typeparam>
  616. /// <param name="container">The set to remove values from.</param>
  617. /// <param name="other">The collection to compare with.</param>
  618. public static void IntersectWith<T>(this ref UnsafeHashSet<T> container, FixedList4096Bytes<T> other)
  619. where T : unmanaged, IEquatable<T>
  620. {
  621. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  622. foreach (var item in other)
  623. {
  624. if (container.Contains(item))
  625. {
  626. result.Add(item);
  627. }
  628. }
  629. container.Clear();
  630. container.UnionWith(result);
  631. result.Dispose();
  632. }
  633. /// <summary>
  634. /// Adds all values from a collection to this set.
  635. /// </summary>
  636. /// <typeparam name="T">The type of values.</typeparam>
  637. /// <param name="container">The set to add values to.</param>
  638. /// <param name="other">The collection to copy values from.</param>
  639. public static void UnionWith<T>(this ref UnsafeHashSet<T> container, FixedList4096Bytes<T> other)
  640. where T : unmanaged, IEquatable<T>
  641. {
  642. foreach (var item in other)
  643. {
  644. container.Add(item);
  645. }
  646. }
  647. /// <summary>
  648. /// Removes the values from this set which are also present in another collection.
  649. /// </summary>
  650. /// <typeparam name="T">The type of values.</typeparam>
  651. /// <param name="container">The set to remove values from.</param>
  652. /// <param name="other">The collection to compare with.</param>
  653. public static void ExceptWith<T>(this ref UnsafeHashSet<T> container, FixedList512Bytes<T> other)
  654. where T : unmanaged, IEquatable<T>
  655. {
  656. foreach (var item in other)
  657. {
  658. container.Remove(item);
  659. }
  660. }
  661. /// <summary>
  662. /// Removes the values from this set which are absent in another collection.
  663. /// </summary>
  664. /// <typeparam name="T">The type of values.</typeparam>
  665. /// <param name="container">The set to remove values from.</param>
  666. /// <param name="other">The collection to compare with.</param>
  667. public static void IntersectWith<T>(this ref UnsafeHashSet<T> container, FixedList512Bytes<T> other)
  668. where T : unmanaged, IEquatable<T>
  669. {
  670. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  671. foreach (var item in other)
  672. {
  673. if (container.Contains(item))
  674. {
  675. result.Add(item);
  676. }
  677. }
  678. container.Clear();
  679. container.UnionWith(result);
  680. result.Dispose();
  681. }
  682. /// <summary>
  683. /// Adds all values from a collection to this set.
  684. /// </summary>
  685. /// <typeparam name="T">The type of values.</typeparam>
  686. /// <param name="container">The set to add values to.</param>
  687. /// <param name="other">The collection to copy values from.</param>
  688. public static void UnionWith<T>(this ref UnsafeHashSet<T> container, FixedList512Bytes<T> other)
  689. where T : unmanaged, IEquatable<T>
  690. {
  691. foreach (var item in other)
  692. {
  693. container.Add(item);
  694. }
  695. }
  696. /// <summary>
  697. /// Removes the values from this set which are also present in another collection.
  698. /// </summary>
  699. /// <typeparam name="T">The type of values.</typeparam>
  700. /// <param name="container">The set to remove values from.</param>
  701. /// <param name="other">The collection to compare with.</param>
  702. public static void ExceptWith<T>(this ref UnsafeHashSet<T> container, FixedList64Bytes<T> other)
  703. where T : unmanaged, IEquatable<T>
  704. {
  705. foreach (var item in other)
  706. {
  707. container.Remove(item);
  708. }
  709. }
  710. /// <summary>
  711. /// Removes the values from this set which are absent in another collection.
  712. /// </summary>
  713. /// <typeparam name="T">The type of values.</typeparam>
  714. /// <param name="container">The set to remove values from.</param>
  715. /// <param name="other">The collection to compare with.</param>
  716. public static void IntersectWith<T>(this ref UnsafeHashSet<T> container, FixedList64Bytes<T> other)
  717. where T : unmanaged, IEquatable<T>
  718. {
  719. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  720. foreach (var item in other)
  721. {
  722. if (container.Contains(item))
  723. {
  724. result.Add(item);
  725. }
  726. }
  727. container.Clear();
  728. container.UnionWith(result);
  729. result.Dispose();
  730. }
  731. /// <summary>
  732. /// Adds all values from a collection to this set.
  733. /// </summary>
  734. /// <typeparam name="T">The type of values.</typeparam>
  735. /// <param name="container">The set to add values to.</param>
  736. /// <param name="other">The collection to copy values from.</param>
  737. public static void UnionWith<T>(this ref UnsafeHashSet<T> container, FixedList64Bytes<T> other)
  738. where T : unmanaged, IEquatable<T>
  739. {
  740. foreach (var item in other)
  741. {
  742. container.Add(item);
  743. }
  744. }
  745. /// <summary>
  746. /// Removes the values from this set which are also present in another collection.
  747. /// </summary>
  748. /// <typeparam name="T">The type of values.</typeparam>
  749. /// <param name="container">The set to remove values from.</param>
  750. /// <param name="other">The collection to compare with.</param>
  751. public static void ExceptWith<T>(this ref UnsafeHashSet<T> container, NativeArray<T> other)
  752. where T : unmanaged, IEquatable<T>
  753. {
  754. foreach (var item in other)
  755. {
  756. container.Remove(item);
  757. }
  758. }
  759. /// <summary>
  760. /// Removes the values from this set which are absent in another collection.
  761. /// </summary>
  762. /// <typeparam name="T">The type of values.</typeparam>
  763. /// <param name="container">The set to remove values from.</param>
  764. /// <param name="other">The collection to compare with.</param>
  765. public static void IntersectWith<T>(this ref UnsafeHashSet<T> container, NativeArray<T> other)
  766. where T : unmanaged, IEquatable<T>
  767. {
  768. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  769. foreach (var item in other)
  770. {
  771. if (container.Contains(item))
  772. {
  773. result.Add(item);
  774. }
  775. }
  776. container.Clear();
  777. container.UnionWith(result);
  778. result.Dispose();
  779. }
  780. /// <summary>
  781. /// Adds all values from a collection to this set.
  782. /// </summary>
  783. /// <typeparam name="T">The type of values.</typeparam>
  784. /// <param name="container">The set to add values to.</param>
  785. /// <param name="other">The collection to copy values from.</param>
  786. public static void UnionWith<T>(this ref UnsafeHashSet<T> container, NativeArray<T> other)
  787. where T : unmanaged, IEquatable<T>
  788. {
  789. foreach (var item in other)
  790. {
  791. container.Add(item);
  792. }
  793. }
  794. /// <summary>
  795. /// Removes the values from this set which are also present in another collection.
  796. /// </summary>
  797. /// <typeparam name="T">The type of values.</typeparam>
  798. /// <param name="container">The set to remove values from.</param>
  799. /// <param name="other">The collection to compare with.</param>
  800. public static void ExceptWith<T>(this ref UnsafeHashSet<T> container, NativeHashSet<T> other)
  801. where T : unmanaged, IEquatable<T>
  802. {
  803. foreach (var item in other)
  804. {
  805. container.Remove(item);
  806. }
  807. }
  808. /// <summary>
  809. /// Removes the values from this set which are absent in another collection.
  810. /// </summary>
  811. /// <typeparam name="T">The type of values.</typeparam>
  812. /// <param name="container">The set to remove values from.</param>
  813. /// <param name="other">The collection to compare with.</param>
  814. public static void IntersectWith<T>(this ref UnsafeHashSet<T> container, NativeHashSet<T> other)
  815. where T : unmanaged, IEquatable<T>
  816. {
  817. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  818. foreach (var item in other)
  819. {
  820. if (container.Contains(item))
  821. {
  822. result.Add(item);
  823. }
  824. }
  825. container.Clear();
  826. container.UnionWith(result);
  827. result.Dispose();
  828. }
  829. /// <summary>
  830. /// Adds all values from a collection to this set.
  831. /// </summary>
  832. /// <typeparam name="T">The type of values.</typeparam>
  833. /// <param name="container">The set to add values to.</param>
  834. /// <param name="other">The collection to copy values from.</param>
  835. public static void UnionWith<T>(this ref UnsafeHashSet<T> container, NativeHashSet<T> other)
  836. where T : unmanaged, IEquatable<T>
  837. {
  838. foreach (var item in other)
  839. {
  840. container.Add(item);
  841. }
  842. }
  843. /// <summary>
  844. /// Removes the values from this set which are also present in another collection.
  845. /// </summary>
  846. /// <typeparam name="T">The type of values.</typeparam>
  847. /// <param name="container">The set to remove values from.</param>
  848. /// <param name="other">The collection to compare with.</param>
  849. public static void ExceptWith<T>(this ref UnsafeHashSet<T> container, NativeHashSet<T>.ReadOnly other)
  850. where T : unmanaged, IEquatable<T>
  851. {
  852. foreach (var item in other)
  853. {
  854. container.Remove(item);
  855. }
  856. }
  857. /// <summary>
  858. /// Removes the values from this set which are absent in another collection.
  859. /// </summary>
  860. /// <typeparam name="T">The type of values.</typeparam>
  861. /// <param name="container">The set to remove values from.</param>
  862. /// <param name="other">The collection to compare with.</param>
  863. public static void IntersectWith<T>(this ref UnsafeHashSet<T> container, NativeHashSet<T>.ReadOnly other)
  864. where T : unmanaged, IEquatable<T>
  865. {
  866. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  867. foreach (var item in other)
  868. {
  869. if (container.Contains(item))
  870. {
  871. result.Add(item);
  872. }
  873. }
  874. container.Clear();
  875. container.UnionWith(result);
  876. result.Dispose();
  877. }
  878. /// <summary>
  879. /// Adds all values from a collection to this set.
  880. /// </summary>
  881. /// <typeparam name="T">The type of values.</typeparam>
  882. /// <param name="container">The set to add values to.</param>
  883. /// <param name="other">The collection to copy values from.</param>
  884. public static void UnionWith<T>(this ref UnsafeHashSet<T> container, NativeHashSet<T>.ReadOnly other)
  885. where T : unmanaged, IEquatable<T>
  886. {
  887. foreach (var item in other)
  888. {
  889. container.Add(item);
  890. }
  891. }
  892. /// <summary>
  893. /// Removes the values from this set which are also present in another collection.
  894. /// </summary>
  895. /// <typeparam name="T">The type of values.</typeparam>
  896. /// <param name="container">The set to remove values from.</param>
  897. /// <param name="other">The collection to compare with.</param>
  898. public static void ExceptWith<T>(this ref UnsafeHashSet<T> container, UnsafeHashSet<T> other)
  899. where T : unmanaged, IEquatable<T>
  900. {
  901. foreach (var item in other)
  902. {
  903. container.Remove(item);
  904. }
  905. }
  906. /// <summary>
  907. /// Removes the values from this set which are absent in another collection.
  908. /// </summary>
  909. /// <typeparam name="T">The type of values.</typeparam>
  910. /// <param name="container">The set to remove values from.</param>
  911. /// <param name="other">The collection to compare with.</param>
  912. public static void IntersectWith<T>(this ref UnsafeHashSet<T> container, UnsafeHashSet<T> other)
  913. where T : unmanaged, IEquatable<T>
  914. {
  915. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  916. foreach (var item in other)
  917. {
  918. if (container.Contains(item))
  919. {
  920. result.Add(item);
  921. }
  922. }
  923. container.Clear();
  924. container.UnionWith(result);
  925. result.Dispose();
  926. }
  927. /// <summary>
  928. /// Adds all values from a collection to this set.
  929. /// </summary>
  930. /// <typeparam name="T">The type of values.</typeparam>
  931. /// <param name="container">The set to add values to.</param>
  932. /// <param name="other">The collection to copy values from.</param>
  933. public static void UnionWith<T>(this ref UnsafeHashSet<T> container, UnsafeHashSet<T> other)
  934. where T : unmanaged, IEquatable<T>
  935. {
  936. foreach (var item in other)
  937. {
  938. container.Add(item);
  939. }
  940. }
  941. /// <summary>
  942. /// Removes the values from this set which are also present in another collection.
  943. /// </summary>
  944. /// <typeparam name="T">The type of values.</typeparam>
  945. /// <param name="container">The set to remove values from.</param>
  946. /// <param name="other">The collection to compare with.</param>
  947. public static void ExceptWith<T>(this ref UnsafeHashSet<T> container, UnsafeHashSet<T>.ReadOnly other)
  948. where T : unmanaged, IEquatable<T>
  949. {
  950. foreach (var item in other)
  951. {
  952. container.Remove(item);
  953. }
  954. }
  955. /// <summary>
  956. /// Removes the values from this set which are absent in another collection.
  957. /// </summary>
  958. /// <typeparam name="T">The type of values.</typeparam>
  959. /// <param name="container">The set to remove values from.</param>
  960. /// <param name="other">The collection to compare with.</param>
  961. public static void IntersectWith<T>(this ref UnsafeHashSet<T> container, UnsafeHashSet<T>.ReadOnly other)
  962. where T : unmanaged, IEquatable<T>
  963. {
  964. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  965. foreach (var item in other)
  966. {
  967. if (container.Contains(item))
  968. {
  969. result.Add(item);
  970. }
  971. }
  972. container.Clear();
  973. container.UnionWith(result);
  974. result.Dispose();
  975. }
  976. /// <summary>
  977. /// Adds all values from a collection to this set.
  978. /// </summary>
  979. /// <typeparam name="T">The type of values.</typeparam>
  980. /// <param name="container">The set to add values to.</param>
  981. /// <param name="other">The collection to copy values from.</param>
  982. public static void UnionWith<T>(this ref UnsafeHashSet<T> container, UnsafeHashSet<T>.ReadOnly other)
  983. where T : unmanaged, IEquatable<T>
  984. {
  985. foreach (var item in other)
  986. {
  987. container.Add(item);
  988. }
  989. }
  990. /// <summary>
  991. /// Removes the values from this set which are also present in another collection.
  992. /// </summary>
  993. /// <typeparam name="T">The type of values.</typeparam>
  994. /// <param name="container">The set to remove values from.</param>
  995. /// <param name="other">The collection to compare with.</param>
  996. public static void ExceptWith<T>(this ref UnsafeHashSet<T> container, NativeParallelHashSet<T> other)
  997. where T : unmanaged, IEquatable<T>
  998. {
  999. foreach (var item in other)
  1000. {
  1001. container.Remove(item);
  1002. }
  1003. }
  1004. /// <summary>
  1005. /// Removes the values from this set which are absent in another collection.
  1006. /// </summary>
  1007. /// <typeparam name="T">The type of values.</typeparam>
  1008. /// <param name="container">The set to remove values from.</param>
  1009. /// <param name="other">The collection to compare with.</param>
  1010. public static void IntersectWith<T>(this ref UnsafeHashSet<T> container, NativeParallelHashSet<T> other)
  1011. where T : unmanaged, IEquatable<T>
  1012. {
  1013. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  1014. foreach (var item in other)
  1015. {
  1016. if (container.Contains(item))
  1017. {
  1018. result.Add(item);
  1019. }
  1020. }
  1021. container.Clear();
  1022. container.UnionWith(result);
  1023. result.Dispose();
  1024. }
  1025. /// <summary>
  1026. /// Adds all values from a collection to this set.
  1027. /// </summary>
  1028. /// <typeparam name="T">The type of values.</typeparam>
  1029. /// <param name="container">The set to add values to.</param>
  1030. /// <param name="other">The collection to copy values from.</param>
  1031. public static void UnionWith<T>(this ref UnsafeHashSet<T> container, NativeParallelHashSet<T> other)
  1032. where T : unmanaged, IEquatable<T>
  1033. {
  1034. foreach (var item in other)
  1035. {
  1036. container.Add(item);
  1037. }
  1038. }
  1039. /// <summary>
  1040. /// Removes the values from this set which are also present in another collection.
  1041. /// </summary>
  1042. /// <typeparam name="T">The type of values.</typeparam>
  1043. /// <param name="container">The set to remove values from.</param>
  1044. /// <param name="other">The collection to compare with.</param>
  1045. public static void ExceptWith<T>(this ref UnsafeHashSet<T> container, NativeParallelHashSet<T>.ReadOnly other)
  1046. where T : unmanaged, IEquatable<T>
  1047. {
  1048. foreach (var item in other)
  1049. {
  1050. container.Remove(item);
  1051. }
  1052. }
  1053. /// <summary>
  1054. /// Removes the values from this set which are absent in another collection.
  1055. /// </summary>
  1056. /// <typeparam name="T">The type of values.</typeparam>
  1057. /// <param name="container">The set to remove values from.</param>
  1058. /// <param name="other">The collection to compare with.</param>
  1059. public static void IntersectWith<T>(this ref UnsafeHashSet<T> container, NativeParallelHashSet<T>.ReadOnly other)
  1060. where T : unmanaged, IEquatable<T>
  1061. {
  1062. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  1063. foreach (var item in other)
  1064. {
  1065. if (container.Contains(item))
  1066. {
  1067. result.Add(item);
  1068. }
  1069. }
  1070. container.Clear();
  1071. container.UnionWith(result);
  1072. result.Dispose();
  1073. }
  1074. /// <summary>
  1075. /// Adds all values from a collection to this set.
  1076. /// </summary>
  1077. /// <typeparam name="T">The type of values.</typeparam>
  1078. /// <param name="container">The set to add values to.</param>
  1079. /// <param name="other">The collection to copy values from.</param>
  1080. public static void UnionWith<T>(this ref UnsafeHashSet<T> container, NativeParallelHashSet<T>.ReadOnly other)
  1081. where T : unmanaged, IEquatable<T>
  1082. {
  1083. foreach (var item in other)
  1084. {
  1085. container.Add(item);
  1086. }
  1087. }
  1088. /// <summary>
  1089. /// Removes the values from this set which are also present in another collection.
  1090. /// </summary>
  1091. /// <typeparam name="T">The type of values.</typeparam>
  1092. /// <param name="container">The set to remove values from.</param>
  1093. /// <param name="other">The collection to compare with.</param>
  1094. public static void ExceptWith<T>(this ref UnsafeHashSet<T> container, UnsafeParallelHashSet<T> other)
  1095. where T : unmanaged, IEquatable<T>
  1096. {
  1097. foreach (var item in other)
  1098. {
  1099. container.Remove(item);
  1100. }
  1101. }
  1102. /// <summary>
  1103. /// Removes the values from this set which are absent in another collection.
  1104. /// </summary>
  1105. /// <typeparam name="T">The type of values.</typeparam>
  1106. /// <param name="container">The set to remove values from.</param>
  1107. /// <param name="other">The collection to compare with.</param>
  1108. public static void IntersectWith<T>(this ref UnsafeHashSet<T> container, UnsafeParallelHashSet<T> other)
  1109. where T : unmanaged, IEquatable<T>
  1110. {
  1111. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  1112. foreach (var item in other)
  1113. {
  1114. if (container.Contains(item))
  1115. {
  1116. result.Add(item);
  1117. }
  1118. }
  1119. container.Clear();
  1120. container.UnionWith(result);
  1121. result.Dispose();
  1122. }
  1123. /// <summary>
  1124. /// Adds all values from a collection to this set.
  1125. /// </summary>
  1126. /// <typeparam name="T">The type of values.</typeparam>
  1127. /// <param name="container">The set to add values to.</param>
  1128. /// <param name="other">The collection to copy values from.</param>
  1129. public static void UnionWith<T>(this ref UnsafeHashSet<T> container, UnsafeParallelHashSet<T> other)
  1130. where T : unmanaged, IEquatable<T>
  1131. {
  1132. foreach (var item in other)
  1133. {
  1134. container.Add(item);
  1135. }
  1136. }
  1137. /// <summary>
  1138. /// Removes the values from this set which are also present in another collection.
  1139. /// </summary>
  1140. /// <typeparam name="T">The type of values.</typeparam>
  1141. /// <param name="container">The set to remove values from.</param>
  1142. /// <param name="other">The collection to compare with.</param>
  1143. public static void ExceptWith<T>(this ref UnsafeHashSet<T> container, UnsafeParallelHashSet<T>.ReadOnly other)
  1144. where T : unmanaged, IEquatable<T>
  1145. {
  1146. foreach (var item in other)
  1147. {
  1148. container.Remove(item);
  1149. }
  1150. }
  1151. /// <summary>
  1152. /// Removes the values from this set which are absent in another collection.
  1153. /// </summary>
  1154. /// <typeparam name="T">The type of values.</typeparam>
  1155. /// <param name="container">The set to remove values from.</param>
  1156. /// <param name="other">The collection to compare with.</param>
  1157. public static void IntersectWith<T>(this ref UnsafeHashSet<T> container, UnsafeParallelHashSet<T>.ReadOnly other)
  1158. where T : unmanaged, IEquatable<T>
  1159. {
  1160. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  1161. foreach (var item in other)
  1162. {
  1163. if (container.Contains(item))
  1164. {
  1165. result.Add(item);
  1166. }
  1167. }
  1168. container.Clear();
  1169. container.UnionWith(result);
  1170. result.Dispose();
  1171. }
  1172. /// <summary>
  1173. /// Adds all values from a collection to this set.
  1174. /// </summary>
  1175. /// <typeparam name="T">The type of values.</typeparam>
  1176. /// <param name="container">The set to add values to.</param>
  1177. /// <param name="other">The collection to copy values from.</param>
  1178. public static void UnionWith<T>(this ref UnsafeHashSet<T> container, UnsafeParallelHashSet<T>.ReadOnly other)
  1179. where T : unmanaged, IEquatable<T>
  1180. {
  1181. foreach (var item in other)
  1182. {
  1183. container.Add(item);
  1184. }
  1185. }
  1186. /// <summary>
  1187. /// Removes the values from this set which are also present in another collection.
  1188. /// </summary>
  1189. /// <typeparam name="T">The type of values.</typeparam>
  1190. /// <param name="container">The set to remove values from.</param>
  1191. /// <param name="other">The collection to compare with.</param>
  1192. public static void ExceptWith<T>(this ref UnsafeHashSet<T> container, NativeList<T> other)
  1193. where T : unmanaged, IEquatable<T>
  1194. {
  1195. foreach (var item in other)
  1196. {
  1197. container.Remove(item);
  1198. }
  1199. }
  1200. /// <summary>
  1201. /// Removes the values from this set which are absent in another collection.
  1202. /// </summary>
  1203. /// <typeparam name="T">The type of values.</typeparam>
  1204. /// <param name="container">The set to remove values from.</param>
  1205. /// <param name="other">The collection to compare with.</param>
  1206. public static void IntersectWith<T>(this ref UnsafeHashSet<T> container, NativeList<T> other)
  1207. where T : unmanaged, IEquatable<T>
  1208. {
  1209. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  1210. foreach (var item in other)
  1211. {
  1212. if (container.Contains(item))
  1213. {
  1214. result.Add(item);
  1215. }
  1216. }
  1217. container.Clear();
  1218. container.UnionWith(result);
  1219. result.Dispose();
  1220. }
  1221. /// <summary>
  1222. /// Adds all values from a collection to this set.
  1223. /// </summary>
  1224. /// <typeparam name="T">The type of values.</typeparam>
  1225. /// <param name="container">The set to add values to.</param>
  1226. /// <param name="other">The collection to copy values from.</param>
  1227. public static void UnionWith<T>(this ref UnsafeHashSet<T> container, NativeList<T> other)
  1228. where T : unmanaged, IEquatable<T>
  1229. {
  1230. foreach (var item in other)
  1231. {
  1232. container.Add(item);
  1233. }
  1234. }
  1235. /// <summary>
  1236. /// Removes the values from this set which are also present in another collection.
  1237. /// </summary>
  1238. /// <typeparam name="T">The type of values.</typeparam>
  1239. /// <param name="container">The set to remove values from.</param>
  1240. /// <param name="other">The collection to compare with.</param>
  1241. public static void ExceptWith<T>(this ref UnsafeHashSet<T> container, UnsafeList<T> other)
  1242. where T : unmanaged, IEquatable<T>
  1243. {
  1244. foreach (var item in other)
  1245. {
  1246. container.Remove(item);
  1247. }
  1248. }
  1249. /// <summary>
  1250. /// Removes the values from this set which are absent in another collection.
  1251. /// </summary>
  1252. /// <typeparam name="T">The type of values.</typeparam>
  1253. /// <param name="container">The set to remove values from.</param>
  1254. /// <param name="other">The collection to compare with.</param>
  1255. public static void IntersectWith<T>(this ref UnsafeHashSet<T> container, UnsafeList<T> other)
  1256. where T : unmanaged, IEquatable<T>
  1257. {
  1258. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  1259. foreach (var item in other)
  1260. {
  1261. if (container.Contains(item))
  1262. {
  1263. result.Add(item);
  1264. }
  1265. }
  1266. container.Clear();
  1267. container.UnionWith(result);
  1268. result.Dispose();
  1269. }
  1270. /// <summary>
  1271. /// Adds all values from a collection to this set.
  1272. /// </summary>
  1273. /// <typeparam name="T">The type of values.</typeparam>
  1274. /// <param name="container">The set to add values to.</param>
  1275. /// <param name="other">The collection to copy values from.</param>
  1276. public static void UnionWith<T>(this ref UnsafeHashSet<T> container, UnsafeList<T> other)
  1277. where T : unmanaged, IEquatable<T>
  1278. {
  1279. foreach (var item in other)
  1280. {
  1281. container.Add(item);
  1282. }
  1283. }
  1284. /// <summary>
  1285. /// Removes the values from this set which are also present in another collection.
  1286. /// </summary>
  1287. /// <typeparam name="T">The type of values.</typeparam>
  1288. /// <param name="container">The set to remove values from.</param>
  1289. /// <param name="other">The collection to compare with.</param>
  1290. public static void ExceptWith<T>(this ref UnsafeParallelHashSet<T> container, FixedList128Bytes<T> other)
  1291. where T : unmanaged, IEquatable<T>
  1292. {
  1293. foreach (var item in other)
  1294. {
  1295. container.Remove(item);
  1296. }
  1297. }
  1298. /// <summary>
  1299. /// Removes the values from this set which are absent in another collection.
  1300. /// </summary>
  1301. /// <typeparam name="T">The type of values.</typeparam>
  1302. /// <param name="container">The set to remove values from.</param>
  1303. /// <param name="other">The collection to compare with.</param>
  1304. public static void IntersectWith<T>(this ref UnsafeParallelHashSet<T> container, FixedList128Bytes<T> other)
  1305. where T : unmanaged, IEquatable<T>
  1306. {
  1307. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  1308. foreach (var item in other)
  1309. {
  1310. if (container.Contains(item))
  1311. {
  1312. result.Add(item);
  1313. }
  1314. }
  1315. container.Clear();
  1316. container.UnionWith(result);
  1317. result.Dispose();
  1318. }
  1319. /// <summary>
  1320. /// Adds all values from a collection to this set.
  1321. /// </summary>
  1322. /// <typeparam name="T">The type of values.</typeparam>
  1323. /// <param name="container">The set to add values to.</param>
  1324. /// <param name="other">The collection to copy values from.</param>
  1325. public static void UnionWith<T>(this ref UnsafeParallelHashSet<T> container, FixedList128Bytes<T> other)
  1326. where T : unmanaged, IEquatable<T>
  1327. {
  1328. foreach (var item in other)
  1329. {
  1330. container.Add(item);
  1331. }
  1332. }
  1333. /// <summary>
  1334. /// Removes the values from this set which are also present in another collection.
  1335. /// </summary>
  1336. /// <typeparam name="T">The type of values.</typeparam>
  1337. /// <param name="container">The set to remove values from.</param>
  1338. /// <param name="other">The collection to compare with.</param>
  1339. public static void ExceptWith<T>(this ref UnsafeParallelHashSet<T> container, FixedList32Bytes<T> other)
  1340. where T : unmanaged, IEquatable<T>
  1341. {
  1342. foreach (var item in other)
  1343. {
  1344. container.Remove(item);
  1345. }
  1346. }
  1347. /// <summary>
  1348. /// Removes the values from this set which are absent in another collection.
  1349. /// </summary>
  1350. /// <typeparam name="T">The type of values.</typeparam>
  1351. /// <param name="container">The set to remove values from.</param>
  1352. /// <param name="other">The collection to compare with.</param>
  1353. public static void IntersectWith<T>(this ref UnsafeParallelHashSet<T> container, FixedList32Bytes<T> other)
  1354. where T : unmanaged, IEquatable<T>
  1355. {
  1356. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  1357. foreach (var item in other)
  1358. {
  1359. if (container.Contains(item))
  1360. {
  1361. result.Add(item);
  1362. }
  1363. }
  1364. container.Clear();
  1365. container.UnionWith(result);
  1366. result.Dispose();
  1367. }
  1368. /// <summary>
  1369. /// Adds all values from a collection to this set.
  1370. /// </summary>
  1371. /// <typeparam name="T">The type of values.</typeparam>
  1372. /// <param name="container">The set to add values to.</param>
  1373. /// <param name="other">The collection to copy values from.</param>
  1374. public static void UnionWith<T>(this ref UnsafeParallelHashSet<T> container, FixedList32Bytes<T> other)
  1375. where T : unmanaged, IEquatable<T>
  1376. {
  1377. foreach (var item in other)
  1378. {
  1379. container.Add(item);
  1380. }
  1381. }
  1382. /// <summary>
  1383. /// Removes the values from this set which are also present in another collection.
  1384. /// </summary>
  1385. /// <typeparam name="T">The type of values.</typeparam>
  1386. /// <param name="container">The set to remove values from.</param>
  1387. /// <param name="other">The collection to compare with.</param>
  1388. public static void ExceptWith<T>(this ref UnsafeParallelHashSet<T> container, FixedList4096Bytes<T> other)
  1389. where T : unmanaged, IEquatable<T>
  1390. {
  1391. foreach (var item in other)
  1392. {
  1393. container.Remove(item);
  1394. }
  1395. }
  1396. /// <summary>
  1397. /// Removes the values from this set which are absent in another collection.
  1398. /// </summary>
  1399. /// <typeparam name="T">The type of values.</typeparam>
  1400. /// <param name="container">The set to remove values from.</param>
  1401. /// <param name="other">The collection to compare with.</param>
  1402. public static void IntersectWith<T>(this ref UnsafeParallelHashSet<T> container, FixedList4096Bytes<T> other)
  1403. where T : unmanaged, IEquatable<T>
  1404. {
  1405. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  1406. foreach (var item in other)
  1407. {
  1408. if (container.Contains(item))
  1409. {
  1410. result.Add(item);
  1411. }
  1412. }
  1413. container.Clear();
  1414. container.UnionWith(result);
  1415. result.Dispose();
  1416. }
  1417. /// <summary>
  1418. /// Adds all values from a collection to this set.
  1419. /// </summary>
  1420. /// <typeparam name="T">The type of values.</typeparam>
  1421. /// <param name="container">The set to add values to.</param>
  1422. /// <param name="other">The collection to copy values from.</param>
  1423. public static void UnionWith<T>(this ref UnsafeParallelHashSet<T> container, FixedList4096Bytes<T> other)
  1424. where T : unmanaged, IEquatable<T>
  1425. {
  1426. foreach (var item in other)
  1427. {
  1428. container.Add(item);
  1429. }
  1430. }
  1431. /// <summary>
  1432. /// Removes the values from this set which are also present in another collection.
  1433. /// </summary>
  1434. /// <typeparam name="T">The type of values.</typeparam>
  1435. /// <param name="container">The set to remove values from.</param>
  1436. /// <param name="other">The collection to compare with.</param>
  1437. public static void ExceptWith<T>(this ref UnsafeParallelHashSet<T> container, FixedList512Bytes<T> other)
  1438. where T : unmanaged, IEquatable<T>
  1439. {
  1440. foreach (var item in other)
  1441. {
  1442. container.Remove(item);
  1443. }
  1444. }
  1445. /// <summary>
  1446. /// Removes the values from this set which are absent in another collection.
  1447. /// </summary>
  1448. /// <typeparam name="T">The type of values.</typeparam>
  1449. /// <param name="container">The set to remove values from.</param>
  1450. /// <param name="other">The collection to compare with.</param>
  1451. public static void IntersectWith<T>(this ref UnsafeParallelHashSet<T> container, FixedList512Bytes<T> other)
  1452. where T : unmanaged, IEquatable<T>
  1453. {
  1454. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  1455. foreach (var item in other)
  1456. {
  1457. if (container.Contains(item))
  1458. {
  1459. result.Add(item);
  1460. }
  1461. }
  1462. container.Clear();
  1463. container.UnionWith(result);
  1464. result.Dispose();
  1465. }
  1466. /// <summary>
  1467. /// Adds all values from a collection to this set.
  1468. /// </summary>
  1469. /// <typeparam name="T">The type of values.</typeparam>
  1470. /// <param name="container">The set to add values to.</param>
  1471. /// <param name="other">The collection to copy values from.</param>
  1472. public static void UnionWith<T>(this ref UnsafeParallelHashSet<T> container, FixedList512Bytes<T> other)
  1473. where T : unmanaged, IEquatable<T>
  1474. {
  1475. foreach (var item in other)
  1476. {
  1477. container.Add(item);
  1478. }
  1479. }
  1480. /// <summary>
  1481. /// Removes the values from this set which are also present in another collection.
  1482. /// </summary>
  1483. /// <typeparam name="T">The type of values.</typeparam>
  1484. /// <param name="container">The set to remove values from.</param>
  1485. /// <param name="other">The collection to compare with.</param>
  1486. public static void ExceptWith<T>(this ref UnsafeParallelHashSet<T> container, FixedList64Bytes<T> other)
  1487. where T : unmanaged, IEquatable<T>
  1488. {
  1489. foreach (var item in other)
  1490. {
  1491. container.Remove(item);
  1492. }
  1493. }
  1494. /// <summary>
  1495. /// Removes the values from this set which are absent in another collection.
  1496. /// </summary>
  1497. /// <typeparam name="T">The type of values.</typeparam>
  1498. /// <param name="container">The set to remove values from.</param>
  1499. /// <param name="other">The collection to compare with.</param>
  1500. public static void IntersectWith<T>(this ref UnsafeParallelHashSet<T> container, FixedList64Bytes<T> other)
  1501. where T : unmanaged, IEquatable<T>
  1502. {
  1503. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  1504. foreach (var item in other)
  1505. {
  1506. if (container.Contains(item))
  1507. {
  1508. result.Add(item);
  1509. }
  1510. }
  1511. container.Clear();
  1512. container.UnionWith(result);
  1513. result.Dispose();
  1514. }
  1515. /// <summary>
  1516. /// Adds all values from a collection to this set.
  1517. /// </summary>
  1518. /// <typeparam name="T">The type of values.</typeparam>
  1519. /// <param name="container">The set to add values to.</param>
  1520. /// <param name="other">The collection to copy values from.</param>
  1521. public static void UnionWith<T>(this ref UnsafeParallelHashSet<T> container, FixedList64Bytes<T> other)
  1522. where T : unmanaged, IEquatable<T>
  1523. {
  1524. foreach (var item in other)
  1525. {
  1526. container.Add(item);
  1527. }
  1528. }
  1529. /// <summary>
  1530. /// Removes the values from this set which are also present in another collection.
  1531. /// </summary>
  1532. /// <typeparam name="T">The type of values.</typeparam>
  1533. /// <param name="container">The set to remove values from.</param>
  1534. /// <param name="other">The collection to compare with.</param>
  1535. public static void ExceptWith<T>(this ref UnsafeParallelHashSet<T> container, NativeArray<T> other)
  1536. where T : unmanaged, IEquatable<T>
  1537. {
  1538. foreach (var item in other)
  1539. {
  1540. container.Remove(item);
  1541. }
  1542. }
  1543. /// <summary>
  1544. /// Removes the values from this set which are absent in another collection.
  1545. /// </summary>
  1546. /// <typeparam name="T">The type of values.</typeparam>
  1547. /// <param name="container">The set to remove values from.</param>
  1548. /// <param name="other">The collection to compare with.</param>
  1549. public static void IntersectWith<T>(this ref UnsafeParallelHashSet<T> container, NativeArray<T> other)
  1550. where T : unmanaged, IEquatable<T>
  1551. {
  1552. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  1553. foreach (var item in other)
  1554. {
  1555. if (container.Contains(item))
  1556. {
  1557. result.Add(item);
  1558. }
  1559. }
  1560. container.Clear();
  1561. container.UnionWith(result);
  1562. result.Dispose();
  1563. }
  1564. /// <summary>
  1565. /// Adds all values from a collection to this set.
  1566. /// </summary>
  1567. /// <typeparam name="T">The type of values.</typeparam>
  1568. /// <param name="container">The set to add values to.</param>
  1569. /// <param name="other">The collection to copy values from.</param>
  1570. public static void UnionWith<T>(this ref UnsafeParallelHashSet<T> container, NativeArray<T> other)
  1571. where T : unmanaged, IEquatable<T>
  1572. {
  1573. foreach (var item in other)
  1574. {
  1575. container.Add(item);
  1576. }
  1577. }
  1578. /// <summary>
  1579. /// Removes the values from this set which are also present in another collection.
  1580. /// </summary>
  1581. /// <typeparam name="T">The type of values.</typeparam>
  1582. /// <param name="container">The set to remove values from.</param>
  1583. /// <param name="other">The collection to compare with.</param>
  1584. public static void ExceptWith<T>(this ref UnsafeParallelHashSet<T> container, NativeHashSet<T> other)
  1585. where T : unmanaged, IEquatable<T>
  1586. {
  1587. foreach (var item in other)
  1588. {
  1589. container.Remove(item);
  1590. }
  1591. }
  1592. /// <summary>
  1593. /// Removes the values from this set which are absent in another collection.
  1594. /// </summary>
  1595. /// <typeparam name="T">The type of values.</typeparam>
  1596. /// <param name="container">The set to remove values from.</param>
  1597. /// <param name="other">The collection to compare with.</param>
  1598. public static void IntersectWith<T>(this ref UnsafeParallelHashSet<T> container, NativeHashSet<T> other)
  1599. where T : unmanaged, IEquatable<T>
  1600. {
  1601. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  1602. foreach (var item in other)
  1603. {
  1604. if (container.Contains(item))
  1605. {
  1606. result.Add(item);
  1607. }
  1608. }
  1609. container.Clear();
  1610. container.UnionWith(result);
  1611. result.Dispose();
  1612. }
  1613. /// <summary>
  1614. /// Adds all values from a collection to this set.
  1615. /// </summary>
  1616. /// <typeparam name="T">The type of values.</typeparam>
  1617. /// <param name="container">The set to add values to.</param>
  1618. /// <param name="other">The collection to copy values from.</param>
  1619. public static void UnionWith<T>(this ref UnsafeParallelHashSet<T> container, NativeHashSet<T> other)
  1620. where T : unmanaged, IEquatable<T>
  1621. {
  1622. foreach (var item in other)
  1623. {
  1624. container.Add(item);
  1625. }
  1626. }
  1627. /// <summary>
  1628. /// Removes the values from this set which are also present in another collection.
  1629. /// </summary>
  1630. /// <typeparam name="T">The type of values.</typeparam>
  1631. /// <param name="container">The set to remove values from.</param>
  1632. /// <param name="other">The collection to compare with.</param>
  1633. public static void ExceptWith<T>(this ref UnsafeParallelHashSet<T> container, NativeHashSet<T>.ReadOnly other)
  1634. where T : unmanaged, IEquatable<T>
  1635. {
  1636. foreach (var item in other)
  1637. {
  1638. container.Remove(item);
  1639. }
  1640. }
  1641. /// <summary>
  1642. /// Removes the values from this set which are absent in another collection.
  1643. /// </summary>
  1644. /// <typeparam name="T">The type of values.</typeparam>
  1645. /// <param name="container">The set to remove values from.</param>
  1646. /// <param name="other">The collection to compare with.</param>
  1647. public static void IntersectWith<T>(this ref UnsafeParallelHashSet<T> container, NativeHashSet<T>.ReadOnly other)
  1648. where T : unmanaged, IEquatable<T>
  1649. {
  1650. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  1651. foreach (var item in other)
  1652. {
  1653. if (container.Contains(item))
  1654. {
  1655. result.Add(item);
  1656. }
  1657. }
  1658. container.Clear();
  1659. container.UnionWith(result);
  1660. result.Dispose();
  1661. }
  1662. /// <summary>
  1663. /// Adds all values from a collection to this set.
  1664. /// </summary>
  1665. /// <typeparam name="T">The type of values.</typeparam>
  1666. /// <param name="container">The set to add values to.</param>
  1667. /// <param name="other">The collection to copy values from.</param>
  1668. public static void UnionWith<T>(this ref UnsafeParallelHashSet<T> container, NativeHashSet<T>.ReadOnly other)
  1669. where T : unmanaged, IEquatable<T>
  1670. {
  1671. foreach (var item in other)
  1672. {
  1673. container.Add(item);
  1674. }
  1675. }
  1676. /// <summary>
  1677. /// Removes the values from this set which are also present in another collection.
  1678. /// </summary>
  1679. /// <typeparam name="T">The type of values.</typeparam>
  1680. /// <param name="container">The set to remove values from.</param>
  1681. /// <param name="other">The collection to compare with.</param>
  1682. public static void ExceptWith<T>(this ref UnsafeParallelHashSet<T> container, UnsafeHashSet<T> other)
  1683. where T : unmanaged, IEquatable<T>
  1684. {
  1685. foreach (var item in other)
  1686. {
  1687. container.Remove(item);
  1688. }
  1689. }
  1690. /// <summary>
  1691. /// Removes the values from this set which are absent in another collection.
  1692. /// </summary>
  1693. /// <typeparam name="T">The type of values.</typeparam>
  1694. /// <param name="container">The set to remove values from.</param>
  1695. /// <param name="other">The collection to compare with.</param>
  1696. public static void IntersectWith<T>(this ref UnsafeParallelHashSet<T> container, UnsafeHashSet<T> other)
  1697. where T : unmanaged, IEquatable<T>
  1698. {
  1699. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  1700. foreach (var item in other)
  1701. {
  1702. if (container.Contains(item))
  1703. {
  1704. result.Add(item);
  1705. }
  1706. }
  1707. container.Clear();
  1708. container.UnionWith(result);
  1709. result.Dispose();
  1710. }
  1711. /// <summary>
  1712. /// Adds all values from a collection to this set.
  1713. /// </summary>
  1714. /// <typeparam name="T">The type of values.</typeparam>
  1715. /// <param name="container">The set to add values to.</param>
  1716. /// <param name="other">The collection to copy values from.</param>
  1717. public static void UnionWith<T>(this ref UnsafeParallelHashSet<T> container, UnsafeHashSet<T> other)
  1718. where T : unmanaged, IEquatable<T>
  1719. {
  1720. foreach (var item in other)
  1721. {
  1722. container.Add(item);
  1723. }
  1724. }
  1725. /// <summary>
  1726. /// Removes the values from this set which are also present in another collection.
  1727. /// </summary>
  1728. /// <typeparam name="T">The type of values.</typeparam>
  1729. /// <param name="container">The set to remove values from.</param>
  1730. /// <param name="other">The collection to compare with.</param>
  1731. public static void ExceptWith<T>(this ref UnsafeParallelHashSet<T> container, UnsafeHashSet<T>.ReadOnly other)
  1732. where T : unmanaged, IEquatable<T>
  1733. {
  1734. foreach (var item in other)
  1735. {
  1736. container.Remove(item);
  1737. }
  1738. }
  1739. /// <summary>
  1740. /// Removes the values from this set which are absent in another collection.
  1741. /// </summary>
  1742. /// <typeparam name="T">The type of values.</typeparam>
  1743. /// <param name="container">The set to remove values from.</param>
  1744. /// <param name="other">The collection to compare with.</param>
  1745. public static void IntersectWith<T>(this ref UnsafeParallelHashSet<T> container, UnsafeHashSet<T>.ReadOnly other)
  1746. where T : unmanaged, IEquatable<T>
  1747. {
  1748. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  1749. foreach (var item in other)
  1750. {
  1751. if (container.Contains(item))
  1752. {
  1753. result.Add(item);
  1754. }
  1755. }
  1756. container.Clear();
  1757. container.UnionWith(result);
  1758. result.Dispose();
  1759. }
  1760. /// <summary>
  1761. /// Adds all values from a collection to this set.
  1762. /// </summary>
  1763. /// <typeparam name="T">The type of values.</typeparam>
  1764. /// <param name="container">The set to add values to.</param>
  1765. /// <param name="other">The collection to copy values from.</param>
  1766. public static void UnionWith<T>(this ref UnsafeParallelHashSet<T> container, UnsafeHashSet<T>.ReadOnly other)
  1767. where T : unmanaged, IEquatable<T>
  1768. {
  1769. foreach (var item in other)
  1770. {
  1771. container.Add(item);
  1772. }
  1773. }
  1774. /// <summary>
  1775. /// Removes the values from this set which are also present in another collection.
  1776. /// </summary>
  1777. /// <typeparam name="T">The type of values.</typeparam>
  1778. /// <param name="container">The set to remove values from.</param>
  1779. /// <param name="other">The collection to compare with.</param>
  1780. public static void ExceptWith<T>(this ref UnsafeParallelHashSet<T> container, NativeParallelHashSet<T> other)
  1781. where T : unmanaged, IEquatable<T>
  1782. {
  1783. foreach (var item in other)
  1784. {
  1785. container.Remove(item);
  1786. }
  1787. }
  1788. /// <summary>
  1789. /// Removes the values from this set which are absent in another collection.
  1790. /// </summary>
  1791. /// <typeparam name="T">The type of values.</typeparam>
  1792. /// <param name="container">The set to remove values from.</param>
  1793. /// <param name="other">The collection to compare with.</param>
  1794. public static void IntersectWith<T>(this ref UnsafeParallelHashSet<T> container, NativeParallelHashSet<T> other)
  1795. where T : unmanaged, IEquatable<T>
  1796. {
  1797. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  1798. foreach (var item in other)
  1799. {
  1800. if (container.Contains(item))
  1801. {
  1802. result.Add(item);
  1803. }
  1804. }
  1805. container.Clear();
  1806. container.UnionWith(result);
  1807. result.Dispose();
  1808. }
  1809. /// <summary>
  1810. /// Adds all values from a collection to this set.
  1811. /// </summary>
  1812. /// <typeparam name="T">The type of values.</typeparam>
  1813. /// <param name="container">The set to add values to.</param>
  1814. /// <param name="other">The collection to copy values from.</param>
  1815. public static void UnionWith<T>(this ref UnsafeParallelHashSet<T> container, NativeParallelHashSet<T> other)
  1816. where T : unmanaged, IEquatable<T>
  1817. {
  1818. foreach (var item in other)
  1819. {
  1820. container.Add(item);
  1821. }
  1822. }
  1823. /// <summary>
  1824. /// Removes the values from this set which are also present in another collection.
  1825. /// </summary>
  1826. /// <typeparam name="T">The type of values.</typeparam>
  1827. /// <param name="container">The set to remove values from.</param>
  1828. /// <param name="other">The collection to compare with.</param>
  1829. public static void ExceptWith<T>(this ref UnsafeParallelHashSet<T> container, NativeParallelHashSet<T>.ReadOnly other)
  1830. where T : unmanaged, IEquatable<T>
  1831. {
  1832. foreach (var item in other)
  1833. {
  1834. container.Remove(item);
  1835. }
  1836. }
  1837. /// <summary>
  1838. /// Removes the values from this set which are absent in another collection.
  1839. /// </summary>
  1840. /// <typeparam name="T">The type of values.</typeparam>
  1841. /// <param name="container">The set to remove values from.</param>
  1842. /// <param name="other">The collection to compare with.</param>
  1843. public static void IntersectWith<T>(this ref UnsafeParallelHashSet<T> container, NativeParallelHashSet<T>.ReadOnly other)
  1844. where T : unmanaged, IEquatable<T>
  1845. {
  1846. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  1847. foreach (var item in other)
  1848. {
  1849. if (container.Contains(item))
  1850. {
  1851. result.Add(item);
  1852. }
  1853. }
  1854. container.Clear();
  1855. container.UnionWith(result);
  1856. result.Dispose();
  1857. }
  1858. /// <summary>
  1859. /// Adds all values from a collection to this set.
  1860. /// </summary>
  1861. /// <typeparam name="T">The type of values.</typeparam>
  1862. /// <param name="container">The set to add values to.</param>
  1863. /// <param name="other">The collection to copy values from.</param>
  1864. public static void UnionWith<T>(this ref UnsafeParallelHashSet<T> container, NativeParallelHashSet<T>.ReadOnly other)
  1865. where T : unmanaged, IEquatable<T>
  1866. {
  1867. foreach (var item in other)
  1868. {
  1869. container.Add(item);
  1870. }
  1871. }
  1872. /// <summary>
  1873. /// Removes the values from this set which are also present in another collection.
  1874. /// </summary>
  1875. /// <typeparam name="T">The type of values.</typeparam>
  1876. /// <param name="container">The set to remove values from.</param>
  1877. /// <param name="other">The collection to compare with.</param>
  1878. public static void ExceptWith<T>(this ref UnsafeParallelHashSet<T> container, UnsafeParallelHashSet<T> other)
  1879. where T : unmanaged, IEquatable<T>
  1880. {
  1881. foreach (var item in other)
  1882. {
  1883. container.Remove(item);
  1884. }
  1885. }
  1886. /// <summary>
  1887. /// Removes the values from this set which are absent in another collection.
  1888. /// </summary>
  1889. /// <typeparam name="T">The type of values.</typeparam>
  1890. /// <param name="container">The set to remove values from.</param>
  1891. /// <param name="other">The collection to compare with.</param>
  1892. public static void IntersectWith<T>(this ref UnsafeParallelHashSet<T> container, UnsafeParallelHashSet<T> other)
  1893. where T : unmanaged, IEquatable<T>
  1894. {
  1895. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  1896. foreach (var item in other)
  1897. {
  1898. if (container.Contains(item))
  1899. {
  1900. result.Add(item);
  1901. }
  1902. }
  1903. container.Clear();
  1904. container.UnionWith(result);
  1905. result.Dispose();
  1906. }
  1907. /// <summary>
  1908. /// Adds all values from a collection to this set.
  1909. /// </summary>
  1910. /// <typeparam name="T">The type of values.</typeparam>
  1911. /// <param name="container">The set to add values to.</param>
  1912. /// <param name="other">The collection to copy values from.</param>
  1913. public static void UnionWith<T>(this ref UnsafeParallelHashSet<T> container, UnsafeParallelHashSet<T> other)
  1914. where T : unmanaged, IEquatable<T>
  1915. {
  1916. foreach (var item in other)
  1917. {
  1918. container.Add(item);
  1919. }
  1920. }
  1921. /// <summary>
  1922. /// Removes the values from this set which are also present in another collection.
  1923. /// </summary>
  1924. /// <typeparam name="T">The type of values.</typeparam>
  1925. /// <param name="container">The set to remove values from.</param>
  1926. /// <param name="other">The collection to compare with.</param>
  1927. public static void ExceptWith<T>(this ref UnsafeParallelHashSet<T> container, UnsafeParallelHashSet<T>.ReadOnly other)
  1928. where T : unmanaged, IEquatable<T>
  1929. {
  1930. foreach (var item in other)
  1931. {
  1932. container.Remove(item);
  1933. }
  1934. }
  1935. /// <summary>
  1936. /// Removes the values from this set which are absent in another collection.
  1937. /// </summary>
  1938. /// <typeparam name="T">The type of values.</typeparam>
  1939. /// <param name="container">The set to remove values from.</param>
  1940. /// <param name="other">The collection to compare with.</param>
  1941. public static void IntersectWith<T>(this ref UnsafeParallelHashSet<T> container, UnsafeParallelHashSet<T>.ReadOnly other)
  1942. where T : unmanaged, IEquatable<T>
  1943. {
  1944. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  1945. foreach (var item in other)
  1946. {
  1947. if (container.Contains(item))
  1948. {
  1949. result.Add(item);
  1950. }
  1951. }
  1952. container.Clear();
  1953. container.UnionWith(result);
  1954. result.Dispose();
  1955. }
  1956. /// <summary>
  1957. /// Adds all values from a collection to this set.
  1958. /// </summary>
  1959. /// <typeparam name="T">The type of values.</typeparam>
  1960. /// <param name="container">The set to add values to.</param>
  1961. /// <param name="other">The collection to copy values from.</param>
  1962. public static void UnionWith<T>(this ref UnsafeParallelHashSet<T> container, UnsafeParallelHashSet<T>.ReadOnly other)
  1963. where T : unmanaged, IEquatable<T>
  1964. {
  1965. foreach (var item in other)
  1966. {
  1967. container.Add(item);
  1968. }
  1969. }
  1970. /// <summary>
  1971. /// Removes the values from this set which are also present in another collection.
  1972. /// </summary>
  1973. /// <typeparam name="T">The type of values.</typeparam>
  1974. /// <param name="container">The set to remove values from.</param>
  1975. /// <param name="other">The collection to compare with.</param>
  1976. public static void ExceptWith<T>(this ref UnsafeParallelHashSet<T> container, NativeList<T> other)
  1977. where T : unmanaged, IEquatable<T>
  1978. {
  1979. foreach (var item in other)
  1980. {
  1981. container.Remove(item);
  1982. }
  1983. }
  1984. /// <summary>
  1985. /// Removes the values from this set which are absent in another collection.
  1986. /// </summary>
  1987. /// <typeparam name="T">The type of values.</typeparam>
  1988. /// <param name="container">The set to remove values from.</param>
  1989. /// <param name="other">The collection to compare with.</param>
  1990. public static void IntersectWith<T>(this ref UnsafeParallelHashSet<T> container, NativeList<T> other)
  1991. where T : unmanaged, IEquatable<T>
  1992. {
  1993. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  1994. foreach (var item in other)
  1995. {
  1996. if (container.Contains(item))
  1997. {
  1998. result.Add(item);
  1999. }
  2000. }
  2001. container.Clear();
  2002. container.UnionWith(result);
  2003. result.Dispose();
  2004. }
  2005. /// <summary>
  2006. /// Adds all values from a collection to this set.
  2007. /// </summary>
  2008. /// <typeparam name="T">The type of values.</typeparam>
  2009. /// <param name="container">The set to add values to.</param>
  2010. /// <param name="other">The collection to copy values from.</param>
  2011. public static void UnionWith<T>(this ref UnsafeParallelHashSet<T> container, NativeList<T> other)
  2012. where T : unmanaged, IEquatable<T>
  2013. {
  2014. foreach (var item in other)
  2015. {
  2016. container.Add(item);
  2017. }
  2018. }
  2019. /// <summary>
  2020. /// Removes the values from this set which are also present in another collection.
  2021. /// </summary>
  2022. /// <typeparam name="T">The type of values.</typeparam>
  2023. /// <param name="container">The set to remove values from.</param>
  2024. /// <param name="other">The collection to compare with.</param>
  2025. public static void ExceptWith<T>(this ref UnsafeParallelHashSet<T> container, UnsafeList<T> other)
  2026. where T : unmanaged, IEquatable<T>
  2027. {
  2028. foreach (var item in other)
  2029. {
  2030. container.Remove(item);
  2031. }
  2032. }
  2033. /// <summary>
  2034. /// Removes the values from this set which are absent in another collection.
  2035. /// </summary>
  2036. /// <typeparam name="T">The type of values.</typeparam>
  2037. /// <param name="container">The set to remove values from.</param>
  2038. /// <param name="other">The collection to compare with.</param>
  2039. public static void IntersectWith<T>(this ref UnsafeParallelHashSet<T> container, UnsafeList<T> other)
  2040. where T : unmanaged, IEquatable<T>
  2041. {
  2042. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  2043. foreach (var item in other)
  2044. {
  2045. if (container.Contains(item))
  2046. {
  2047. result.Add(item);
  2048. }
  2049. }
  2050. container.Clear();
  2051. container.UnionWith(result);
  2052. result.Dispose();
  2053. }
  2054. /// <summary>
  2055. /// Adds all values from a collection to this set.
  2056. /// </summary>
  2057. /// <typeparam name="T">The type of values.</typeparam>
  2058. /// <param name="container">The set to add values to.</param>
  2059. /// <param name="other">The collection to copy values from.</param>
  2060. public static void UnionWith<T>(this ref UnsafeParallelHashSet<T> container, UnsafeList<T> other)
  2061. where T : unmanaged, IEquatable<T>
  2062. {
  2063. foreach (var item in other)
  2064. {
  2065. container.Add(item);
  2066. }
  2067. }
  2068. }
  2069. }