diff --git a/core/includes/common.inc b/core/includes/common.inc
index 3ff8096..5f7f9f0 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -2,6 +2,7 @@
 
 use Drupal\Component\Utility\Crypt;
 use Drupal\Component\Utility\Json;
+use Drupal\Component\Utility\SortArray;
 use Drupal\Component\Utility\String;
 use Drupal\Component\Utility\Tags;
 use Drupal\Component\Utility\UrlValidator;
@@ -5100,14 +5101,12 @@ function drupal_render_cid_create($elements) {
  *   that optionally include a '#weight' key.
  * @param $b
  *   Second item for comparison.
+ *
+ * @see \Drupal\Component\Utility\SortArray::sortByNumber()
  */
 function element_sort($a, $b) {
-  $a_weight = (is_array($a) && isset($a['#weight'])) ? $a['#weight'] : 0;
-  $b_weight = (is_array($b) && isset($b['#weight'])) ? $b['#weight'] : 0;
-  if ($a_weight == $b_weight) {
-    return 0;
-  }
-  return ($a_weight < $b_weight) ? -1 : 1;
+  $sort = new SortArray('#weight');
+  return $sort->sortByNumber($a, $b);
 }
 
 /**
@@ -5122,11 +5121,12 @@ function element_sort($a, $b) {
  *   that optionally include a '#title' key.
  * @param $b
  *   Second item for comparison.
+ *
+ * @see \Drupal\Component\Utility\SortArray::sortByString()
  */
 function element_sort_by_title($a, $b) {
-  $a_title = (is_array($a) && isset($a['#title'])) ? $a['#title'] : '';
-  $b_title = (is_array($b) && isset($b['#title'])) ? $b['#title'] : '';
-  return strnatcasecmp($a_title, $b_title);
+  $sort = new SortArray('#title');
+  return $sort->sortByString($a, $b);
 }
 
 /**
@@ -5184,14 +5184,13 @@ function element_info_property($type, $property_name, $default = NULL) {
  *   element, a default value of 0 will be used.
  * @param $b
  *   Second item for comparison.
+ *
+ * @see \Drupal\Component\Utility\SortArray::sortByNumber()
+ *
  */
-function drupal_sort_weight($a, $b) {
-  $a_weight = (is_array($a) && isset($a['weight'])) ? $a['weight'] : 0;
-  $b_weight = (is_array($b) && isset($b['weight'])) ? $b['weight'] : 0;
-  if ($a_weight == $b_weight) {
-    return 0;
-  }
-  return ($a_weight < $b_weight) ? -1 : 1;
+function drupal_sort_weight(array $a, array $b) {
+  $sort = new SortArray('weight');
+  return $sort->sortByNumber($a, $b);
 }
 
 /**
@@ -5204,15 +5203,12 @@ function drupal_sort_weight($a, $b) {
  *   that optionally include a 'title' key.
  * @param $b
  *   Second item for comparison.
+ *
+ * @see \Drupal\Component\Utility\SortArray::sortByString()
  */
 function drupal_sort_title($a, $b) {
-  if (!isset($b['title'])) {
-    return -1;
-  }
-  if (!isset($a['title'])) {
-    return 1;
-  }
-  return strcasecmp($a['title'], $b['title']);
+  $sort = new SortArray('title');
+  return $sort->sortByString($a, $b);
 }
 
 /**
diff --git a/core/lib/Drupal/Component/Utility/SortArray.php b/core/lib/Drupal/Component/Utility/SortArray.php
new file mode 100644
index 0000000..d117e03
--- /dev/null
+++ b/core/lib/Drupal/Component/Utility/SortArray.php
@@ -0,0 +1,78 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Component\Utility\SortArray.
+ */
+
+namespace Drupal\Component\Utility;
+
+/**
+ * Provides generic array sorting helper methods.
+ */
+class SortArray {
+
+  /**
+   * @var The element to sort by.
+   */
+  protected $element;
+
+  public function __construct($element) {
+    $this->element = $element;
+  }
+
+  /**
+   * Sorts a structured array by the 'weight' element.
+   *
+   * Note that the sorting is by the 'weight' array element, not by the render
+   * element property '#weight'.
+   *
+   * Callback for uasort() used in various functions.
+   *
+   * @param array $a
+   *   First item for comparison. The compared items should be associative
+   *   arrays that optionally include a 'weight' element. For items without a
+   *   'weight' element, a default value of 0 will be used.
+   * @param array $b
+   *   Second item for comparison.
+   *
+   * @return int
+   *   The comparison result for uasort().
+   */
+  public function sortByNumber(array $a, array $b) {
+    $property = $this->element;
+    $a_weight = isset($a[$property]) ? $a[$property] : 0;
+    $b_weight = isset($b[$property]) ? $b[$property] : 0;
+    if ($a_weight === $b_weight) {
+      return 0;
+    }
+    return ($a_weight < $b_weight) ? -1 : 1;
+  }
+
+  /**
+   * Sorts a structured array by 'title' key (no # prefix).
+   *
+   * Callback for uasort() within system_admin_index().
+   *
+   * @param array $a
+   *   First item for comparison. The compared items should be associative
+   *   arrays that optionally include a 'title' key.
+   * @param array $b
+   *   Second item for comparison.
+   *
+   * @return int
+   *   The comparison result for uasort().
+   */
+  public function sortByString(array $a, array $b) {
+    $property = $this->element;
+
+    if (!isset($b[$property])) {
+      return -1;
+    }
+    if (!isset($a[$property])) {
+      return 1;
+    }
+    return strcasecmp($a[$property], $b[$property]);
+  }
+
+}
diff --git a/core/lib/Drupal/Core/Entity/EntityListController.php b/core/lib/Drupal/Core/Entity/EntityListController.php
index 1ebab9e..fbd54df 100644
--- a/core/lib/Drupal/Core/Entity/EntityListController.php
+++ b/core/lib/Drupal/Core/Entity/EntityListController.php
@@ -9,6 +9,7 @@
 
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
+use Drupal\Component\Utility\SortArray;
 
 /**
  * Provides a generic implementation of an entity list controller.
@@ -166,7 +167,10 @@ public function buildOperations(EntityInterface $entity) {
     // Retrieve and sort operations.
     $operations = $this->getOperations($entity);
     $this->moduleHandler->alter('entity_operation', $operations, $entity);
-    uasort($operations, 'drupal_sort_weight');
+
+    $sort = new SortArray('weight');
+    uasort($operations, array($sort, 'sortByNumber'));
+
     $build = array(
       '#type' => 'operations',
       '#links' => $operations,
diff --git a/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php b/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php
new file mode 100644
index 0000000..31d932c
--- /dev/null
+++ b/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php
@@ -0,0 +1,200 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Tests\Component\Utility\SortArrayTest.
+ */
+
+namespace Drupal\Tests\Component\Utility;
+
+use Drupal\Tests\UnitTestCase;
+use Drupal\Component\Utility\SortArray;
+
+/**
+ * Tests the MapArray system.
+ *
+ * @see \Drupal\Component\Utility\SortArray
+ */
+class SortArrayTest extends UnitTestCase {
+
+  public static function getInfo() {
+    return array(
+      'name' => 'SortArray test',
+      'description' => 'Test that the SortArray functions work properly.',
+      'group' => 'Common',
+    );
+  }
+
+  /**
+   * Tests SortArray::sortByNumber() input against expected output.
+   *
+   * @dataProvider providersortByNumber
+   *
+   * @param array $property
+   *   The property of the arrays to compare.
+   * @param array $a
+   *   The first input array for the SortArray::sortByNumber() method.
+   * @param array $b
+   *   The second input array for the SortArray::sortByNumber().
+   * @param integer $expected
+   *   The expected output from calling the method.
+   *
+   * @see Drupal\Component\Utility\SortArray::sortByNumber()
+   * @see Drupal\Tests\Component\Utility\SortArrayTest::providersortByNumber()
+   */
+  public function testsortByNumber($property, $a, $b, $expected) {
+    $sort = new SortArray($property);
+    $result = $sort->sortByNumber($a, $b);
+    $this->assertEquals($expected, $result);
+  }
+
+  /**
+   * Data provider for SortArray::sortByNumber().
+   *
+   * @return array
+   *   An array of tests, matching the parameter inputs for testsortByNumber.
+   *
+   * @see \Drupal\Component\Utility\SortArray::sortByNumber()
+   * @see \Drupal\Tests\Component\Utility\SortArrayTest::testSortByNumber()
+   */
+  public function providerSortByNumber() {
+    $tests = array();
+
+    // Weights set and equal
+    $tests[] = array(
+      'weight',
+      array('weight' => 1),
+      array('weight' => 1),
+      0
+    );
+
+    // Weights set and $a is less (lighter) than $b
+    $tests[] = array(
+      'weight',
+      array('weight' => 1),
+      array('weight' => 2),
+      -1
+    );
+
+    // Weights set and $a is greater (heavier) than $b
+    $tests[] = array(
+      'weight',
+      array('weight' => 2),
+      array('weight' => 1),
+      1
+    );
+
+    // Weights not set
+    $tests[] = array(
+      'weight',
+      array(),
+      array(),
+      0
+    );
+
+    // Weights for $b not set
+    $tests[] = array(
+      '#weight',
+      array('#weight' => 1),
+      array(),
+      1
+    );
+
+    // Weights for $a not set
+    $tests[] = array(
+      '#weight',
+      array(),
+      array('#weight' => 1),
+      -1
+    );
+
+    return $tests;
+  }
+
+  /**
+   * Tests SortArray::sortByString() input against expected output.
+   *
+   * @dataProvider providerSortByString
+   *
+   * @param array $property
+   *   The property of the arrays to compare.
+   * @param array $a
+   *   The first input item for comparison.
+   * @param array $b
+   *   The second item for comparison.
+   * @param integer $expected
+   *   The expected output from calling the method.
+   *
+   * @see Drupal\Component\Utility\SortArray::sortByString()
+   * @see Drupal\Tests\Component\Utility\SortArrayTest::providerSortByString()
+   */
+  public function testSortByString($property, $a, $b, $expected) {
+    $sort = new SortArray($property);
+    $result = $sort->sortByString($a, $b);
+    $this->assertEquals($expected, $result);
+  }
+
+  /**
+   * Data provider for SortArray::sortByString().
+   *
+   * @return array
+   *   An array of tests, matching the parameter inputs for testSortByString.
+   *
+   * @see \Drupal\Component\Utility\SortArray::sortByString()
+   * @see \Drupal\Tests\Component\Utility\SortArrayTest::testSortByString()
+   */
+  public function providerSortByString() {
+    $tests = array();
+
+    // Titles set and equal
+    $tests[] = array(
+      'title',
+      array('title' => 'test'),
+      array('title' => 'test'),
+      0
+    );
+
+    // Title $a not set
+    $tests[] = array(
+      'title',
+      array(),
+      array('title' => 'test'),
+      1
+    );
+
+    // Title $b not set
+    $tests[] = array(
+      'title',
+      array('title' => 'test'),
+      array(),
+      -1
+    );
+
+    // Titles set but not equal
+    $tests[] = array(
+      'title',
+      array('title' => 'test'),
+      array('title' => 'testing'),
+      -3
+    );
+
+    // Titles set but not equal
+    $tests[] = array(
+      'title',
+      array('title' => 'testing'),
+      array('title' => 'test'),
+      3
+    );
+
+    // Different property name
+    $tests[] = array(
+      '#title',
+      array('#title' => 'testing'),
+      array('#title' => 'test'),
+      3
+    );
+
+    return $tests;
+  }
+
+}
