Skip to content

Commit e63ebd7

Browse files
committed
Simplifications in Utilities.IsEmpty
1 parent d5b082c commit e63ebd7

1 file changed

Lines changed: 3 additions & 21 deletions

File tree

Plugins/AssetUsageDetector/Editor/Utilities.cs

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -471,46 +471,28 @@ public static bool IsEmpty( this List<ObjectToSearch> objectsToSearch )
471471

472472
for( int i = 0; i < objectsToSearch.Count; i++ )
473473
{
474-
if( objectsToSearch[i].obj != null && !objectsToSearch[i].obj.Equals( null ) )
474+
if( objectsToSearch[i].obj != null )
475475
return false;
476476
}
477477

478478
return true;
479479
}
480480

481481
// Check if all the objects inside the list are null
482-
public static bool IsEmpty( this List<Object> objects )
482+
public static bool IsEmpty<T>( this List<T> objects ) where T : Object
483483
{
484484
if( objects == null )
485485
return true;
486486

487487
for( int i = 0; i < objects.Count; i++ )
488488
{
489-
if( objects[i] != null && !objects[i].Equals( null ) )
489+
if( objects[i] != null )
490490
return false;
491491
}
492492

493493
return true;
494494
}
495495

496-
// Check if all the objects that are enumerated are null
497-
public static bool IsEmpty( this IEnumerable<Object> objects )
498-
{
499-
if( objects == null )
500-
return true;
501-
502-
using( IEnumerator<Object> enumerator = objects.GetEnumerator() )
503-
{
504-
while( enumerator.MoveNext() )
505-
{
506-
if( enumerator.Current != null && !enumerator.Current.Equals( null ) )
507-
return false;
508-
}
509-
}
510-
511-
return true;
512-
}
513-
514496
// Returns true is str starts with prefix
515497
public static bool StartsWithFast( this string str, string prefix )
516498
{

0 commit comments

Comments
 (0)